taskiq-python/taskiq-redis

Limit the number of messages that the worker tries to process at the same time

booqoffsky opened this issue · 1 comments

It seems to use loop.create_task(callback(redis_message)) in the main worker cycle can lead to an undesirable state (the number of tasks in the worker can increase indefinitely).

Maybe it's better to change this mechanism?
Correct me if I'm wrong

I guess you're right. We can change broker API, so brokers won't control how much tasks they will be executing.

My suggestion here is to turn the listen method to async generator. So it would yield new tasks.