withRetry

suspend fun <T> withRetry(policy: RetryPolicy, operation: suspend () -> T): T

Execute an operation with retry logic according to the policy.

Return

Result of the operation

Parameters

policy

The retry policy to apply

operation

The suspend operation to execute

Throws

if all retries are exhausted