python-etcd
python-etcd copied to clipboard
EtcdWatchTimedOut does not been raised when occur
EtcdWatchTimedOut seems raised in _wrap_request (client.py)
def _wrap_request(payload):
...
except (HTTPError, HTTPException, socket.error) as e:
if (isinstance(params, dict) and
params.get("wait") == "true" and
isinstance(e, ReadTimeoutError)):
_log.debug("Watch timed out.")
raise etcd.EtcdWatchTimedOut(
"Watch timed out: %r" % e,
cause=e
)
however, this exception will be catched internally in _acquired (lock.py)
def _acquired(self, blocking=True, timeout=0):
...
while True:
try:
r = self.client.watch(watch_key, timeout=t, index=nearest.modifiedIndex + 1)
_log.debug("Detected variation for %s: %s", r.key, r.action)
return self._acquired(blocking=True, timeout=timeout)
except etcd.EtcdKeyNotFound:
_log.debug("Key %s not present anymore, moving on", watch_key)
return self._acquired(blocking=True, timeout=timeout)
except etcd.EtcdLockExpired as e:
raise e
!!! except etcd.EtcdException:
!!! _log.exception("Unexpected exception")
As a result, while loop will not break even if timeout occur. That's to say, timeout is useless