Skip to content

[5.8] Job Based Retry Delay#28265

Merged
taylorotwell merged 3 commits into
5.8from
job-delay
Apr 18, 2019
Merged

[5.8] Job Based Retry Delay#28265
taylorotwell merged 3 commits into
5.8from
job-delay

Conversation

@taylorotwell

@taylorotwell taylorotwell commented Apr 18, 2019

Copy link
Copy Markdown
Member

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