-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[11.x] Add queue job debouncing #50477
Conversation
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
This does look useful, but couldn't it just be a package that provides the middleware? |
It could be. I think. It would mean that the user needs to add some code for the package to work. Why would you prefer it as a package? |
@nandi95 are you still fixing theses tests? Otherwise best if you resend this when they pass. |
They gonna take a while, yes. I can resend later. The intention was to generate discussion and get feedback. |
Got the tests passing. |
Note
This is a work-in-progress, I would like some feedback and contributions before spending any more time on this.
I have come across the need for such logic multiple times now, so I'm attempting to add this in a backward compatible way. The goal is to make it work with the existing infrastructure so the user doesn't have to add an extra trait or interface to the jobs, they can just start dispatching with debouncing working.
Why add this?
Sometimes a job might do some heavy computation or talk to an external api; things that the developer might decide is a waste of resources and should only be executed every so often. In this case, a debouncing pattern should be available to prevent spamming the logic path.
Example use-cases:
Questions/Considerations to discuss:
Previous discussion: #43946
Rebased to 11.x branch as per request on #50347