RetryPolicy

constructor(maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, initialBackoff: Duration = DEFAULT_INITIAL_BACKOFF, maxBackoff: Duration = DEFAULT_MAX_BACKOFF, jitterFactor: Double = DEFAULT_JITTER_FACTOR, shouldRetry: (Exception) -> Boolean = { true })

Parameters

maxAttempts

Total tries including the first (must be ≥ 1).

initialBackoff

Delay before the second attempt.

maxBackoff

Cap for exponential backoff growth.

jitterFactor

Fraction of the current backoff used as ± jitter (0 disables jitter).

shouldRetry

Return false to stop retrying and rethrow immediately (after the failed attempt). CancellationException is always rethrown and never retried.