-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat(queue): Add failed job backoff configuration #621
Conversation
When trying to test this, do you make jobs fail by calling |
I tried testing without changing code, I tried to create wikis while no mediawiki pods are around (so I guess this is equivalent to the exception throwing). Will try those two ways explicitly, I didn't know about the $job->fail method |
Turns out this makes ALL the difference. Calling While I'm now confident that this PR works as intended, this means that we have to refactor basically every Job class, that we want to respect the retry config (not just the one in this PR, but in general). |
config/queue.php
Outdated
@@ -84,4 +84,5 @@ | |||
'table' => 'failed_jobs', | |||
], | |||
|
|||
'backoff' => explode(',', env('QUEUE_BACKOFF', '10,60,300,900,1500')), // 10s, 1m, 5m, 15m, 30m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone would set QUEUE_BACKOFF to the empty string, would this use the default? I'm wondering if we should have a null default so that we can turn this behavior on and off by means of configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thinking, I removed the values
Currently failed jobs will be retried 5 times[1]. This adds job backoff configuration as suggested here, so that failed retries will happen with incremental delays:
[1] https://github.com/wbstack/api/blob/main/start.sh#L20
Draft status because I couldn't make this work on my local cluster yet.