Skip to content

Commit

Permalink
Refresh task queue first before get task from queue (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz authored Dec 2, 2024
1 parent 7059d24 commit f3cdb40
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/kiwipy/rmq/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ async def next_task(self,
raises:
kiwipy.exceptions.QueueEmpty: When the queue has no tasks within the timeout
"""
# relinquish so that if there is requeue coroutines, they are run first and task queue get updated
await asyncio.sleep(0)

try:
message = await self._task_queue.get(no_ack=no_ack, fail=fail, timeout=timeout)
except aio_pika.exceptions.QueueEmpty as exc:
Expand Down

0 comments on commit f3cdb40

Please sign in to comment.