summaryrefslogtreecommitdiff
path: root/tooz/drivers/etcd.py
diff options
context:
space:
mode:
authorJohn Schwarz <jschwarz@redhat.com>2016-07-14 13:39:17 +0300
committerJohn Schwarz <jschwarz@redhat.com>2016-07-20 16:50:16 +0300
commitf296519c27f6679d4667100333f099aba0840d54 (patch)
tree0f2973faf2678f2614ee28a6c50df90d6054d769 /tooz/drivers/etcd.py
parent324482fa96344410cec56254d61ccf91ea5e9a8b (diff)
downloadtooz-f296519c27f6679d4667100333f099aba0840d54.tar.gz
etcd: properly block when using 'wait'
When using the wait functionality, one must use the last index increased by one, as the wait returns once that index has been used. Using the index that is already been returned by the etcd instance will cause 'wait' to return immediately, producing a busy-wait loop while spamming the server with the same requests over and over. Closes-Bug: #1603002 Change-Id: I4f3bee0a52dcf2eb69b96b53a9f777a5e2a7efb1
Diffstat (limited to 'tooz/drivers/etcd.py')
-rw-r--r--tooz/drivers/etcd.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tooz/drivers/etcd.py b/tooz/drivers/etcd.py
index 81fb179..4ff93f3 100644
--- a/tooz/drivers/etcd.py
+++ b/tooz/drivers/etcd.py
@@ -133,7 +133,7 @@ class EtcdLock(locking.Lock):
try:
reply = self.client.get(
self._lock_url +
- "?wait=true&waitIndex=%d" % reply['index'],
+ "?wait=true&waitIndex=%d" % (reply['index'] + 1),
make_url=False,
timeout=watch.leftover() if watch else None)
except requests.exceptions.RequestException: