Backoff
Randomized exponential backoff mechanism.
val create : ?lower_wait_log:int -> ?upper_wait_log:int -> unit -> t
create
creates a backoff value. upper_wait_log
, lower_wait_log
override the logarithmic upper and lower bound on the number of spins executed by once
.
val default : t
default
is equivalent to create ()
.
once b
executes one random wait and returns a new backoff with logarithm of the current maximum value incremented unless it is already at upper_wait_log
of b
.
Note that this uses the default Stdlib Random
per-domain generator.
reset b
returns a backoff equivalent to b
except with current value set to the lower_wait_log
of b
.