-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Add deleteWhen for throttle exceptions job middleware #55718
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
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. |
Not sure if " |
i was also doing a lot of debating about the naming.. i went this way, because that's what we're doing, we're deleting the job. we are in the context of "throttles exceptions" middleware. so maybe |
"Delete" always makes me thing of database or filesystem action. Even though, that what you are doing with the job, it doesn't entirely describe a distinction to what would happen otherwise imo. Maybe, the naming of |
how about |
Yeah, I guess, this would be more intuitive for me 👍🏻 |
What
Adds
->deleteWhen(..)
toThrottlesExceptions
job middleware (and of courseThrottlesExceptionsWithRedis
)Examples
Details
When using
ThrottlesExceptions
job middleware, we can pass a callback for->when(..)
the job should not be released back and instead throw an exception. But for most use cases, you will likely be retrying this job and therefore the job will be attempted again. The new->deleteWhen(..)
functionality allows you to exit the circuit of either throw exception or release back onto the queue, and instead to just delete the job. In this way, the job will just be deleted when this exception occurs. (Of course, you can still choose to report the exception just like before.)