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

Exponential Backoff Strategy: Pass Array To Backoff Config #925

Closed
MannikJ opened this issue Nov 19, 2020 · 3 comments · Fixed by #926
Closed

Exponential Backoff Strategy: Pass Array To Backoff Config #925

MannikJ opened this issue Nov 19, 2020 · 3 comments · Fixed by #926

Comments

@MannikJ
Copy link

MannikJ commented Nov 19, 2020

As stated here the backoff parameter of the queue system now also excepts an array to define different delays between the retries.

I tried to configure another supervisor like below and wondered why horizon didn't launch the supervisor-2 worker, before I found that the backoff configuration was causing this.

'local' => [
    'supervisor-1' => [
        'connection' => 'redis',
        'queue' => ['default'],
        'balance' => 'simple',
        'processes' => 3,
        'tries' => 1,
    ],
    'supervisor-2' => [
        'connection' => 'redis',
        'queue' => ['webhooks'],
        'balance' => 'simple',
        'processes' => 3,
        'tries' => 5,
        'backoff' => [
            60, // 1 minute
            300, // 5 minutes
            3600, // an hour
            21600, // 6 hours
            86400, // 24 hours
        ],
    ]
],

So will this be supported in the future, or is there any other way to specify a default exponential backoff strategy for a group of jobs/queues?

@driesvints
Copy link
Member

Hey @MannikJ. You can define it as a string:

'local' => [
    'supervisor-1' => [
        'connection' => 'redis',
        'queue' => ['default'],
        'balance' => 'simple',
        'processes' => 3,
        'tries' => 1,
    ],
    'supervisor-2' => [
        'connection' => 'redis',
        'queue' => ['webhooks'],
        'balance' => 'simple',
        'processes' => 3,
        'tries' => 5,
        'backoff' => '60,300,3600,21600,86400',
    ]
],

We can maybe look into translating the array into a string under the hood. If you want you can send in a PR for that 👍

@driesvints
Copy link
Member

Looks like Mohamed was super fast on this one :)

@MannikJ
Copy link
Author

MannikJ commented Nov 19, 2020

Haha, "super fast" feels like an underestimate. Thank you!

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

Successfully merging a pull request may close this issue.

2 participants