-
Notifications
You must be signed in to change notification settings - Fork 37
Description
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