Foundation.Backoff (foundation v0.2.1)

Copy Markdown View Source

Backoff delay calculation with configurable strategies and jitter.

Summary

Functions

Compute the delay for the given attempt based on policy.

Sleep for the computed delay, using the provided sleep function.

Functions

delay(policy, attempt)

Compute the delay for the given attempt based on policy.

sleep(policy, attempt, sleep_fun \\ &Process.sleep/1)

@spec sleep(Foundation.Backoff.Policy.t(), non_neg_integer(), (non_neg_integer() ->
                                                           any())) :: :ok

Sleep for the computed delay, using the provided sleep function.