Vary delays between attempts based on schedule

Created on 18 November 2016, about 8 years ago
Updated 25 September 2024, 3 months ago

It must be possible to vary delay between job attempts based on schedule.

For example, if a task fails, 1st retry should be done after 10 seconds, 2nd one after 1 minute, 3rd one after 5 minutes, etc.

The patch adds support for specifying "retry_delay_schedule" for example as:

  'retry_delay_schedule' => '5,10,60,300',

(illustrating the scenario described above).

The same time delay could also be used multiple times - for example:

  'retry_delay_schedule' => '5*2,10*4,60*5,300',

would mean that:

  • first 2 retries will be done after 5 second delay each
  • next 4 retries will be done after 10 second delay each
  • next 5 retries will be done after 60 second delay each
  • all the remaining retries will be done after 5 minute delay each

If max attempts value is higher than number of defined retry_delay_schedule delays, the last delay value will be used for all the remaining attempts.

The change is 100% backwards compatible, and using 'retry_delay' => 5 still works as before. retry_delay_schedule takes precedence over retry_delay.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇫🇷France maciej.zgadzaj

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    Exponential backoff is a best practice. I wonder if we should implement it by default rather than making it configurable. That keeps the codebase simpler and more maintainable.

Production build 0.71.5 2024