diff options
Diffstat (limited to 'swift/proxy/controllers/container.py')
-rw-r--r-- | swift/proxy/controllers/container.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/swift/proxy/controllers/container.py b/swift/proxy/controllers/container.py index 4ac00d010..a21a55d22 100644 --- a/swift/proxy/controllers/container.py +++ b/swift/proxy/controllers/container.py @@ -20,6 +20,7 @@ import random import six from six.moves.urllib.parse import unquote +from swift.common.memcached import MemcacheConnectionError from swift.common.utils import public, private, csv_append, Timestamp, \ config_true_value, ShardRange, cache_from_env, filter_shard_ranges from swift.common.constraints import check_metadata, CONTAINER_LISTING_LIMIT @@ -152,9 +153,14 @@ class ContainerController(Controller): if skip_chance and random.random() < skip_chance: self.logger.increment('shard_listing.cache.skip') else: - cached_ranges = memcache.get(cache_key) - self.logger.increment('shard_listing.cache.%s' % ( - 'hit' if cached_ranges else 'miss')) + try: + cached_ranges = memcache.get( + cache_key, raise_on_error=True) + cache_state = 'hit' if cached_ranges else 'miss' + except MemcacheConnectionError: + cache_state = 'error' + self.logger.increment( + 'shard_listing.cache.%s' % cache_state) if cached_ranges is not None: infocache[cache_key] = tuple(cached_ranges) |