retryWithExponentialBackoff

fun <T> Flow<T>.retryWithExponentialBackoff(initialDelay: Duration, factor: Double, maxAttempt: Long = Long.MAX_VALUE, maxDelay: Duration = Duration.INFINITE, predicate: suspend (cause: Throwable) -> Boolean = { true }): Flow<T>(source)

Retries collection of the given flow with exponential backoff delay strategy when an exception occurs in the upstream flow and the predicate returns true. When predicate returns true, the next retries will be delayed after a duration computed by DelayStrategy.ExponentialBackoffDelayStrategy.

See retryWhenWithDelayStrategy and DelayStrategy.ExponentialBackoffDelayStrategy for more details.