RetryPolicy

fun interface RetryPolicy

Decides whether (and after how long) a failed request should be retried.

Implement this to plug in custom retry behavior. NetworkClient consults it after every failed attempt: returning a non-negative delay schedules another attempt after that many milliseconds; returning null stops retrying and propagates the error.

The default, DefaultRetryPolicy, retries transient failures with jittered exponential backoff. Use RetryPolicy.None to disable retries entirely.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun retryDelayMillis(attempt: Int, method: HttpMethod, error: NetworkError): Long?

The delay before the upcoming retry, or null to give up.