KRetryRunner

constructor(scope: CoroutineScope, retries: Int = 3, delay: Duration = 250.milliseconds, backoffFactor: Double = 2.0, maxDelay: Duration = 10.seconds, onSuccess: (T) -> Unit? = null, onError: (Throwable) -> Unit? = null)(source)

Parameters

scope

The CoroutineScope that owns the retry jobs.

retries

The maximum number of additional attempts after the first failure. Default: 3.

delay

The initial wait duration between the first and second attempt. Default: 250ms.

backoffFactor

The multiplier applied to the wait duration after each failure. Default: 2.0.

maxDelay

The maximum allowed delay between attempts. Default: 10s.

onSuccess

Optional callback invoked when an attempt succeeds.

onError

Optional callback invoked after each failed attempt.

Type Parameters

T

The type of the result produced by the asynchronous operation.