diff options
Diffstat (limited to 'tooz/drivers/etcd.py')
-rw-r--r-- | tooz/drivers/etcd.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tooz/drivers/etcd.py b/tooz/drivers/etcd.py index 1745d62..87c77fe 100644 --- a/tooz/drivers/etcd.py +++ b/tooz/drivers/etcd.py @@ -188,12 +188,14 @@ class EtcdLock(locking.Lock): poked = self.client.put(self._lock_url, data={"ttl": self.ttl, "prevExist": "true"}, make_url=False) - errorcode = poked.get("errorCode") - if errorcode: - LOG.warning("Unable to heartbeat by updating key '%s' with " - "extended expiry of %s seconds: %d, %s", self.name, - self.ttl, errorcode, poked.get("message")) self._node = poked['node'] + errorcode = poked.get("errorCode") + if not errorcode: + return True + LOG.warning("Unable to heartbeat by updating key '%s' with " + "extended expiry of %s seconds: %d, %s", self.name, + self.ttl, errorcode, poked.get("message")) + return False class EtcdDriver(coordination.CoordinationDriver): |