executeOrFallback

suspend fun <T> executeOrFallback(timeout: Duration? = null, fallback: suspend (TimeoutCancellationException) -> T, block: suspend () -> T): T(source)

Executes an operation with a timeout and fallback.

Return

The result of the operation or fallback

Parameters

timeout

Optional custom timeout (overrides config timeout)

fallback

The fallback function to call if the operation times out

block

The primary operation to execute