[10.x] Fix Queue::push()
ignoring job delays
#46590
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes job delay not working when dispatched like this:
The
delay()
method comes from theQueuable
trait, which is on jobs by default. The code above looks like it should work, but it doesn't. This is a pretty annoying problem to deal with, because during development you're likely to use thesync
queue connection that doesn't support delays. This means you won't notice that the delay doesn't work until you push your code to production.In my case I wrote a job that pinged a server, and on failure re-dispatched itself with a 30 second delay. Because the delay didn't work it executed all attempts in a row instantly without any delay. Luckily I made my code stop after 3 attempts, if I didn't have that limit it would have have been stuck in an infinite loop.
Fixes #46568