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

Randomized exponential backoff #41

Open
mbesida opened this issue Apr 4, 2022 · 0 comments
Open

Randomized exponential backoff #41

mbesida opened this issue Apr 4, 2022 · 0 comments

Comments

@mbesida
Copy link

mbesida commented Apr 4, 2022

I was looking through the codebase and didn't find(maybe just search not thourough enough) an option to set a value which will be used to calculate an addition to delay using randomness. In retry.JitterBackoff I noticed that it uses delay itself for such puprose.
What I mean is following...
Here is the definition of Backoff's apply:
def apply(max: Int = 8, delay: FiniteDuration = Defaults.delay, base: Int = 2). So retry.Backoff(3, 1.second) means that 1st retry will be exactly after 1 second, 2nd retry after 2 seconds, and 3rd retry after 4 seconds.
What I want to achieve is next: 1st retry after (1 + random(0, N)) second, 2nd retry after 2*(1 + random(0, N)) + random(0, N) seconds, and 3rd retry after 2*( 2*(1 + random(0, N)) + random(0, N) ) + random(0, N) seconds.
There is a JitterBackoff but seems for aformentioned N it uses initial delay value.
Is such functionality supported?
PS. I'm neglacting cap here

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

No branches or pull requests

1 participant