Package-level declarations
Types
Link copied to clipboard
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.
Functions
Link copied to clipboard
Like Result.getOrElse, but rethrows CancellationException if present in the failure.
Link copied to clipboard
Handles non-cancellation failures; rethrows CancellationException so the coroutine can cancel.
Link copied to clipboard
If this Result is a failure caused by CancellationException, rethrows it; otherwise returns this.
Link copied to clipboard
suspend fun <T> retryWithBackoff(policy: RetryPolicy = RetryPolicy.DEFAULT, random: Random = Random.Default, block: suspend (attempt: Int) -> T): T
Runs block, retrying on failure with exponential backoff and optional jitter.
Link copied to clipboard
Like runCatching, but rethrows CancellationException so structured concurrency is preserved.
Link copied to clipboard
Suspend variant of runCatchingCancellable. Use instead of runCatching around suspend work.