executeOrFallback

suspend fun <T> executeOrFallback(permits: Int = 1, fallback: suspend () -> T, block: suspend () -> T): T(source)

Executes an operation with a fallback if rate limited.

Return

The result of the operation or fallback

Parameters

permits

Number of permits (tokens) required (default: 1)

fallback

The fallback function to call if rate limited

block

The primary operation to execute