constantDelay

fun constantDelay(duration: Duration, randomizationFactor: Double = 0.0)(source)

Configures the retry delay strategy to use a constant delay. The delay between retries is calculated using the formula:

  • delay + jitter

Example:

constant(500.milliseconds)
// Delay between attempts will be 500ms
constant(500.milliseconds, 0.1)
// Delay between attempts will be something like:
// [495ms, 513ms, 502ms, 507ms, 499ms, ...]

Note:

  • Because the jitter calculation is based on the newly calculated delay, the new delay could be less than the previous value.

Parameters

duration

the constant delay between retries.

randomizationFactor

the randomization factor to add randomness to the calculated delay (e.g., 0.1 for +/-10%).

See also