Skip to content

fix: prefetcher leaks one message at max_tasks_to_execute boundary#630

Open
PythonFZ wants to merge 7 commits into
taskiq-python:masterfrom
PythonFZ:fix-prefetcher-leak-on-max-tasks
Open

fix: prefetcher leaks one message at max_tasks_to_execute boundary#630
PythonFZ wants to merge 7 commits into
taskiq-python:masterfrom
PythonFZ:fix-prefetcher-leak-on-max-tasks

Conversation

@PythonFZ

Copy link
Copy Markdown

Fix using max_tasks_to_execute causes the prefetcher to pop tasks from the queue it has no intention of processing.

Closes #528.

@s3rius

s3rius commented Jun 29, 2026

Copy link
Copy Markdown
Member

Hello. Thanks for your contribution. However, I'd love to move try inside the while loop, because in case of any error prefetcher will stop working completely which will make worker to hang. It might happen, because of asyncio.wait for example.

@PythonFZ

PythonFZ commented Jun 29, 2026

Copy link
Copy Markdown
Author

Hello. Thanks for your contribution. However, I'd love to move try inside the while loop, because in case of any error prefetcher will stop working completely which will make worker to hang. It might happen, because of asyncio.wait for example.

That is a good point, I added a broad try ... except Exception in 592b167 and a test for transient listening failures in adeb379

Does that work for you or are there any concerns with calling iterator = self.broker.listen() in the exception handling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max-prefetch argument doesn't work as expected

2 participants