suspend fun <R> timeoutAndRetry(timeout: Long, block: suspend (Int) -> R?): R
(source)
Cancel and retry a suspending block until a non-null result is obtained.
timeout
- the delay before re-attempting
block
- the suspending block to be executed
Return
the first non-null result
suspend fun <R> timeoutAndRetry(timeout: Long, maxRetries: Int, block: suspend (Int) -> R?): R?
(source)
Cancel and retry a suspending block until a non-null result is obtained.
timeout
- the delay before re-attempting
maxRetries
- the maximum number of attempts
block
- the suspending block to be executed
Return
the first non-null result, or null
if all attempts fail
suspend fun <R> timeoutAndRetry(timeout: (Int) -> Long?, block: suspend (Int) -> R?): R?
(source)
Cancel and retry a suspending block until a non-null result is obtained.
timeout
- a function returning the delay that should follow each attempt, or null
if no further attempts
should be made
block
- the suspending block to be executed
Return
the first non-null result, or null
if all attempts fail