withJitter

open fun withJitter(jitterFactor: Double, random: Random = Random.Default): DelayStrategy

Introduces jitter (randomness) to the retry delay, spreading out the timing of retries.

Jitter helps:

  • Prevent synchronized spikes in load.

  • Avoid contention on shared resources.

  • Improve system stability and throughput when many clients are retrying.

Return

A DelayStrategy that incorporates jitter.

Since

1.0.0

Parameters

jitterFactor

The multiplier used to determine the range of jitter.

random

An optional random number generator, defaulting to Random.Default.