retry

suspend fun <T> retry(clock: TimeSource = TimeSource.Monotonic, block: RetryBlock<T>): T

Retries the given block using this RetryPolicy

Return

The result of the block, if successful.

Since

1.0.0

Parameters

clock

A TimeSource used for measuring the elapsed time in RetryPredicate.shouldRetry (default: TimeSource.Monotonic)

block

The block to be executed and potentially retried.

Throws

if the block fails and no further retry attempts should be made.