johanandren / futiles

The missing utils for working with Scala Futures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

backoff documentation error

jsw opened this issue · comments

README

max(try * 2 ^ time_unit, 1) * jitter

Retry.scala

val jitter = 0.5 + rng.nextFloat()
val k = (math.max(1, 2 ^ tries - 1) * jitter).toInt
backOffUnit * k

Are these equivalent?

Good catch, they are not equivalent. Probably a first idea documented vs what it actually turned up to be. Additionally there is a bug in there as ^ is bitwise XOR and not pow.