DecorrelatedJitterBackoff

A stateless implementation of the AWS decorrelated jitter backoff strategy.

The delay for each attempt is computed as: min(cap, random(base, base * 3^(attempt-1)))

This formula approximates the AWS decorrelated jitter pattern without requiring mutable per-instance state, making it safe to share across concurrent executions.

Throws

if base is not positive or if cap<base.

Constructors

Link copied to clipboard
constructor(base: Duration, cap: Duration)

Properties

Link copied to clipboard

The minimum possible delay. Must be positive.

Link copied to clipboard

The maximum possible delay. Must be >= base.

Functions

Link copied to clipboard
open suspend override fun delay(attempt: Int)

Suspends for the delay duration appropriate for the given attempt (1-based).