Skip to content

async/retry.ts doesn't allow applying jitter to exponential backoff #3378

@lionel-rowe

Description

@lionel-rowe

Is your feature request related to a problem? Please describe.

It seems like one of the major benefits of exponential backoff as a retry strategy is that it can space out the retries with random jitter to prevent bottlenecks, but async/retry.ts currently doesn't implement this or provide it as an option.

Stack Overflow — Why is random jitter applied to back-off strategies?

Suppose you have multiple clients that send messages that collide. They all decide to back off. If they use the same deterministic algorithm to decide how long to wait, they will all retry at the same time -- resulting in another collision. Adding a random factor separates the retries.

Describe the solution you'd like

Add an option to apply jitter (probably just a boolean, or maybe something more fine-grained).

Possibly have this option enabled by default — would there be any disadvantages to doing that?

Describe alternatives you've considered

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions