executeWithRetry

suspend fun <T> executeWithRetry(timeout: Duration? = null, retries: Int = 3, block: suspend () -> T): T(source)

Executes an operation with a timeout and automatic retry on timeout.

Return

The result of the operation

Parameters

timeout

Optional custom timeout (overrides config timeout)

retries

Number of retry attempts on timeout (default: 3)

block

The operation to execute

Throws

if all attempts time out

if the operation fails