Skip to content

Commit 43213f9

Browse files
committed
pulse_worker: don't prefetch more than one message (bug 1981900)
If the first message fails and needs requeuing, the Consumer will immediately be given the next message in the batch. This leads to those message being processed out-of-order. By only fetching one message at a time, the Consumer will retrieve the failed message again on the next fetch. It will continue looping on this message forever until it succeeds, or someone intervenes. This is the desired behaviour. This ensures that no message goes silently unprocessed.
1 parent 7accc40 commit 43213f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

git_hg_sync/pulse_worker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def get_consumers(
5252
_channel: Any,
5353
) -> list[kombu.Consumer]:
5454
consumer = consumer_class(
55-
self.task_queue, auto_declare=False, callbacks=[self.on_task]
55+
self.task_queue,
56+
auto_declare=False,
57+
callbacks=[self.on_task],
58+
prefetch_count=1,
5659
)
5760
logger.debug(f"Using consumer {consumer=}")
5861
return [consumer]

0 commit comments

Comments
 (0)