Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Nonlinear retries #7

Open
jelder opened this issue May 23, 2018 · 0 comments
Open

Nonlinear retries #7

jelder opened this issue May 23, 2018 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jelder
Copy link
Contributor

jelder commented May 23, 2018

Errors are retried immediately and forever. Would be good to enter a truncated exponential backoff loop or similar. A full jitter algorithm is available and in use by the AWS client. We should make sure failed messages are retried after an interval derived from that.

/*
https://www.awsarchitectureblog.com/2015/03/backoff.html
Explore in the console with:
[1,2,3,4,5,6,7,8,9,10].map(fullJitter)
*/
const cap = 30 * 1000
const base = 100
const randomBetween = (min, max) => Math.random() * (max - min) + min
const fullJitter = retryCount => {
const temp = Math.min(cap, Math.pow(base * 2, retryCount))
return temp / 2 + randomBetween(0, temp / 2)
}

@jelder jelder added enhancement New feature or request good first issue Good for newcomers labels May 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant