-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Batch consumer: don't flush unless jobs amount is equal or greater than batch size #54600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for this issue. |
Friendly reminder that this issue exists. If I don't hear anything I'll close this. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
I had the same problem, adding |
One more thing to add - I eventually left flush() method untouched. Because I haven't found the way to gracefully ack/nack every acknowledger. There were still situations when it was not acknowledged, and I've got an exception on worker stop. In my case, batch helped me to speed up processing. And also process smaller batches, when it's not enough for 1 full bunch. (e.g. shouldFlush() == false), or when command stops or restarts. |
Just hit this one as well; could this be reopened @xabbuh? 🙏 |
Description
When defining a batch consumer with a batch size bigger than current amount of messages in queue, it still flushes the queue no matter what by adding FlushBatchHandlersStamp to the envelope. I need it to wait until the amount of jobs would be greater or equal to my batch size OR flush it every X minutes otherwise. I tried to redeclare flush method like this:
But it doesn't really work, because flush() will not be called unless new message in the queue appears.
Then, according to the docs, "... pending batches are flushed when the worker is stopped.", so I tried to add --time-limit to the consumer call. But in this case I'm just getting this error:
The acknowledger was not called by the "..." batch handler
I'm not completely sure whether this is a bug or expected behavior, but it's clear that messenger component is not able to∂ handle batch messages waiting for the needed amount of messages in the queue.
Am I missing something?
Example
Nothing to add here to be honest. Probably it could be additional methods for the BatchHandlerInterface to define some kind of a timeout before force flush or flag if jobs must be flushed if their amount is less than batch size
The text was updated successfully, but these errors were encountered: