BackoffPolicy

data class BackoffPolicy(val initialDelayMs: Long = 500, val maxDelayMs: Long, val multiplier: Double = 2.0, val jitterRatio: Double = 0.2, val maxAttempts: Int = 8, val overallTimeoutMs: Long, val perAttemptTimeoutMs: Long? = null, val random: Random = Random.Default)

Configuration for exponential backoff with jitter. Provides validation to ensure safe, production-ready defaults.

Constructors

Link copied to clipboard
constructor(initialDelayMs: Long = 500, maxDelayMs: Long, multiplier: Double = 2.0, jitterRatio: Double = 0.2, maxAttempts: Int = 8, overallTimeoutMs: Long, perAttemptTimeoutMs: Long? = null, random: Random = Random.Default)

Properties

Link copied to clipboard
val initialDelayMs: Long = 500
Link copied to clipboard
val jitterRatio: Double = 0.2

Ratio in 0.0, 1.0. 0 = no jitter.

Link copied to clipboard
val maxAttempts: Int = 8
Link copied to clipboard
Link copied to clipboard
val multiplier: Double = 2.0
Link copied to clipboard
Link copied to clipboard

Optional per-attempt timeout; null to disable. Must be 0 when set.

Link copied to clipboard

Random source for jitter; injectable for deterministic tests.

Functions

Link copied to clipboard

Computes randomized delay around a base using jitter, clamped to 0, maxDelayMs.