Skip to content

does not work --max-prefetch=1 #389

Answered by s3rius
Randommist asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! Here's an explanation of why this happens:

This issue is specific to RabbitMQ's underlying implementation and the aio-pika library. While it's not necessarily a problem, it might break some expectations.

Essentially, the prefetch-count parameter creates a queue at the worker level, limiting the number of messages coming from the broker. However, aio-pika prefetches messages before they are given to the worker. As a result, you may still see prefetched messages even if the max-prefetch parameter is set to 1.

Updating the qos settings will instruct aio-pika not to prefetch messages and to delegate the task to the taskiq worker entirely.

Hope that has helped.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@s3rius
Comment options

Answer selected by s3rius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants