diff options
| author | John Schwarz <jschwarz@redhat.com> | 2016-07-14 13:39:17 +0300 |
|---|---|---|
| committer | John Schwarz <jschwarz@redhat.com> | 2016-07-20 16:50:16 +0300 |
| commit | f296519c27f6679d4667100333f099aba0840d54 (patch) | |
| tree | 0f2973faf2678f2614ee28a6c50df90d6054d769 /tooz/drivers/etcd.py | |
| parent | 324482fa96344410cec56254d61ccf91ea5e9a8b (diff) | |
| download | tooz-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.py | 2 |
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: |
