Skip to content
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

[5.8] Job Based Retry Delay #28265

Merged
merged 3 commits into from
Apr 18, 2019
Merged

[5.8] Job Based Retry Delay #28265

merged 3 commits into from
Apr 18, 2019

Conversation

taylorotwell
Copy link
Member

@taylorotwell taylorotwell commented Apr 18, 2019

This PR implements support for job based retry delays. Previously, this was only determined at a worker level via the --delay option on the worker command. However, sometimes jobs need to have different failure retry rates for various reasons, such as third-party API limits, etc. This is also in line with allowing job based maximum retries and timeout values.

This should allow queued jobs to determine their own retry delay when necessary. This may be done using a simple retryAfter property (integer - seconds) on the job class.

public $retryAfter = 10;

Or, you may define a retryAfter method if more complex logic is required to determine the retry delay. The method may return an integer or a DateTime. If a timestamp is returned, the seconds until that DateTime is used as the delay (e.g. return now()->addSeconds(5) to delay 5 seconds).

Closes laravel/ideas#537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Job-based retry delay?
1 participant