DefaultRetryPolicy

constructor(maxRetries: Int = DEFAULT_MAX_RETRIES, retryNonIdempotent: Boolean = false, backoffBaseMillis: Long = DEFAULT_BACKOFF_BASE_MILLIS, backoffMaxMillis: Long = DEFAULT_BACKOFF_MAX_MILLIS, isRetryableStatus: (Int) -> Boolean = { it == STATUS_TOO_MANY_REQUESTS || it >= STATUS_SERVER_ERROR }, random: Random = Random.Default)

Parameters

maxRetries

maximum number of retries (beyond the initial attempt). 0 disables retry.

retryNonIdempotent

allow retrying POST/PATCH; off by default to avoid duplicate writes.

backoffBaseMillis

base delay; retry n waits a random value in [0, base * 2^(n-1)].

backoffMaxMillis

upper bound on a single backoff (and on an honored Retry-After).

isRetryableStatus

predicate selecting retryable HTTP status codes; defaults to 429 + 5xx.

random

jitter source, injectable for deterministic tests.