Skip to content

Commit

Permalink
fix(recipe): Delete lock node in queue recipe if entry already consumed
Browse files Browse the repository at this point in the history
Delete lock node if already entry already consumed

Fix #366 

Related: #347 / #373
  • Loading branch information
0xbase12 authored and jeffwidman committed Sep 25, 2018
1 parent ac09667 commit 7a8167d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions kazoo/recipe/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,19 @@ def _take(self, id_):
id=id_),
self.id,
ephemeral=True)
except NodeExistsError:
# Item is already locked
return None

try:
value, stat = self.client.retry(
self.client.get,
"{path}/{id}".format(path=self._entries_path, id=id_))
except (NoNodeError, NodeExistsError):
# Item is already consumed or locked
except NoNodeError:
# Item is already consumed
self.client.delete(
"{path}/{id}".format(
path=self._lock_path,
id=id_))
return None
return (id_, value)

0 comments on commit 7a8167d

Please sign in to comment.