summaryrefslogtreecommitdiff
path: root/tooz/drivers/memcached.py
diff options
context:
space:
mode:
Diffstat (limited to 'tooz/drivers/memcached.py')
-rw-r--r--tooz/drivers/memcached.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tooz/drivers/memcached.py b/tooz/drivers/memcached.py
index 085923c..2ac025b 100644
--- a/tooz/drivers/memcached.py
+++ b/tooz/drivers/memcached.py
@@ -17,6 +17,7 @@
# under the License.
import collections
+import logging
import msgpack
import pymemcache.client
@@ -27,6 +28,9 @@ from tooz import coordination
from tooz import locking
+LOG = logging.getLogger(__name__)
+
+
class Retry(Exception):
"""Exception raised if we need to retry."""
@@ -68,8 +72,12 @@ class MemcachedLock(locking.Lock):
def heartbeat(self):
"""Keep the lock alive."""
- self.coord.client.touch(self.name,
- expire=self.timeout)
+ poked = self.coord.client.touch(self.name,
+ expire=self.timeout,
+ noreply=False)
+ if not poked:
+ LOG.warn("Unable to heartbeat by updating key '%s' with extended"
+ " expiry of %s seconds", self.name, self.timeout)
def get_owner(self):
return self.coord.client.get(self.name)