zcash-android-wallet-sdk / cash.z.wallet.sdk.ext / retryWithBackoff

retryWithBackoff

suspend inline fun retryWithBackoff(noinline onErrorListener: ((Throwable) -> Boolean)? = null, initialDelayMillis: Long = 1000L, maxDelayMillis: Long = MAX_BACKOFF_INTERVAL, block: () -> Unit): Unit

Execute the given block and if it fails, retry with an exponential backoff.

Parameters

onErrorListener - a callback that gets the first shot at processing any error and can veto the retry behavior by returning false.

initialDelayMillis - the initial delay before retrying.

maxDelayMillis - the maximum delay between retrys.

block - the logic to run once and then run again if it fails.