Commit 19188fd0 authored by Nicolas Dumazet's avatar Nicolas Dumazet

do not die completely if memcached server isnt here

Raising KeyError means more cache misses, and it's acceptable:
on the other hand crashing an instance just because you install
a BT that has a memcache cache configured that can't access
the memcache daemon was just wrong.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41372 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81e8d150
...@@ -184,7 +184,14 @@ if memcache is not None: ...@@ -184,7 +184,14 @@ if memcache is not None:
result = self.memcached_connection.get(encoded_key) result = self.memcached_connection.get(encoded_key)
except memcache.Client.MemcachedConnectionError: except memcache.Client.MemcachedConnectionError:
self._initialiseConnection() self._initialiseConnection()
result = self.memcached_connection.get(encoded_key) try:
result = self.memcached_connection.get(encoded_key)
except memcache.Client.MemcachedConnectionError:
# maybe the server is not available at all / misconfigured
LOG('MemcacheTool', 0,
'get command to memcached server (%r) failed'
% (self.server_list,))
raise KeyError
self.local_cache[key] = result self.local_cache[key] = result
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment