Skip to content

Commit

Permalink
Make sure we don't requeue tasks with excessive retries
Browse files Browse the repository at this point in the history
  • Loading branch information
stchris committed Jun 18, 2024
1 parent f94302e commit 3fea636
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ def test_task_queue(self):
dataset.add_task(task_id, "test-op")
channel.close()
with self.assertLogs(level="ERROR") as ctx:
worker.process(blocking=False)
with patch.object(
pika.channel.Channel,
attribute="basic_nack",
return_value=None,
) as nack_fn:
worker.process(blocking=False)
nack_fn.assert_any_call(
delivery_tag=1, multiple=False, requeue=False
)
assert "Max retries reached for task test-task. Aborting." in ctx.output[0]
# Assert that retry count stays the same
assert task.get_retry_count(conn) == 1
Expand Down

0 comments on commit 3fea636

Please sign in to comment.