RetryEngine
object RetryEngine
Pure retry delay calculator. Stateless — no side effects.
Used by platform workers (Android CoroutineWorker, iOS task handler) to determine how long to wait before the next attempt.
Delay formula by policy:
RetryPolicy.None → 0ms (caller should not retry)
RetryPolicy.Linear → delayMillis (fixed)
RetryPolicy.Exponential → initialDelayMillis × 2^retryCount
Example:
val policy = RetryPolicy.Exponential(initialDelayMillis = 5_000)
RetryEngine.nextDelay(0, policy) // 5_000ms
RetryEngine.nextDelay(1, policy) // 10_000ms
RetryEngine.nextDelay(2, policy) // 20_000msContent copied to clipboard