RetryPolicy
class RetryPolicy(val maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, val initialBackoff: Duration = DEFAULT_INITIAL_BACKOFF, val maxBackoff: Duration = DEFAULT_MAX_BACKOFF, val jitterFactor: Double = DEFAULT_JITTER_FACTOR, val shouldRetry: (Exception) -> Boolean = { true })
Policy for retryWithBackoff.
Not a data class: shouldRetry is excluded from equals/hashCode so two policies with the same numeric settings compare equal regardless of predicate identity.
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.