retry With Capped Backoff
suspend fun <R> retryWithCappedBackoff(retries: Long = 3, base: Duration = 200.milliseconds, maxDelay: Duration = 10.seconds, factor: Double = 2.0, block: suspend () -> R): R(source)
Executes a suspend operation with retry using exponential backoff capped at a maximum delay.
Return
The result of the successful execution
Parameters
retries
The maximum number of retry attempts (defaults to 3)
base
The base duration for exponential backoff (defaults to 200 milliseconds)
max Delay
The maximum delay between retries
factor
The exponential factor (defaults to 2.0)
block
The suspend operation to execute
Type Parameters
R
The return type of the suspend operation
Throws
if all retry attempts fail