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

retrySimple

inline fun retrySimple(retries: Int = 2, sleepTime: Long = 20L, block: (Int) -> Unit): Unit

Execute the given block and if it fails, retry up to retries more times, using thread sleep instead of suspending. If none of the retries succeed then throw the final error. This function is intended to be called with no parameters, i.e., it is designed to use its defaults.

Parameters

retries - the number of times to retry. Typically, this should be low.

sleepTime - the amount of time to sleep in between retries. Typically, this should be an amount of time that is hard to perceive.

block - the block of logic to try.