execute

abstract suspend fun <T> execute(block: suspend () -> T): T

Executes block and retries on failure according to the policy configuration.

Return

The result of block when it succeeds and any configured result predicate accepts it, or the last returned value if RetryPolicyConfig.shouldRetryResult keeps requesting retries until RetryPolicyConfig.maxAttempts is reached.

Parameters

block

The suspendable operation to execute and optionally retry.

Type Parameters

T

The return type of the block.

Throws

The last exception if all attempts fail with a thrown error, or if block throws and retry is not applicable.