Skip to content

Commit 3cc86ac

Browse files
authored
Merge pull request #430 from anskornyakov/hotfix/semaphore-deadlock
fix deadlock in nonblocking semaphore acquiring
2 parents c82a98b + a674322 commit 3cc86ac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kazoo/recipe/lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,10 @@ def _inner_acquire(self, blocking, timeout=None):
557557
w = _Watch(duration=timeout)
558558
w.start()
559559
lock = self.client.Lock(self.lock_path, self.data)
560-
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
561-
if not gotten:
562-
return False
563560
try:
561+
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
562+
if not gotten:
563+
return False
564564
while True:
565565
self.wake_event.clear()
566566

0 commit comments

Comments
 (0)