BaseMillisRetryPolicy

Java-friendly base for implementing a RetryPolicy. Java cannot return the Duration that nextRetryDelay needs, so a Java subclass implements shouldRetry and nextRetryDelayMillis instead. Like any RetryPolicy, it must be thread-safe and return quickly.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
override fun nextRetryDelay(failedAttempts: Int): Duration

Returns the delay before the next attempt once failedAttempts attempts have failed, and is called only after shouldRetry returned true. A zero or negative delay retries at once, and Duration.INFINITE waits until the retrying coroutine is canceled.

Link copied to clipboard
abstract fun shouldRetry(failure: Exception, failedAttempts: Int): Boolean

Returns whether to retry once failedAttempts attempts (at least 1) have failed, the last with failure.