backoff
The delay before retry number attempt, doubling each time up to max: exponential backoff.
Attempt 1 waits base, attempt 2 waits 2 × base, attempt 3 4 × base, and so on,
never more than max. Attempt 0 is treated like attempt 1. The arithmetic saturates, so
a huge attempt number gives max instead of overflowing. Nothing sleeps: the caller decides
what to do with the duration (see retry).
Import
Section titled “Import”Cargo feature function (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
attempt | u32 | The number of the attempt that just failed, starting at 1. |
base | Duration | The delay after the first failure. |
max | Duration | The longest delay to ever return. |
Returns
Section titled “Returns”Duration — The duration to wait, between base and max (or max alone if base is larger).
