RetryingEmbedder

constructor(delegate: Embedder, maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, initialDelay: Duration = DEFAULT_INITIAL_DELAY, maxDelay: Duration = DEFAULT_MAX_DELAY, factor: Double = DEFAULT_FACTOR, jitter: Double = DEFAULT_JITTER, retryOn: (Throwable) -> Boolean = { true })

Parameters

delegate

the embedder whose calls are retried.

maxAttempts

total attempts including the first, so 1 disables retrying. Must be positive.

initialDelay

backoff before the second attempt; each further wait multiplies by factor.

maxDelay

ceiling on a single backoff wait, so exponential growth cannot run away.

factor

multiplier applied to the delay after each failed attempt (2.0 doubles it).

jitter

fraction of each computed delay that is randomized away, in [0.0, 1.0]. 0.0 waits the exact backoff; the default 0.5 waits a random span in [0.5, 1.0] of it, so a fleet whose calls all failed together does not retry in lockstep and hammer the provider on the same tick.

retryOn

decides whether a given failure is worth another attempt. Returning false re-throws immediately. CancellationException is excluded before this is ever consulted.