calculateJitteredDelay method

Duration calculateJitteredDelay(
  1. int retries,
  2. Duration baseDelay
)

Implementation

Duration calculateJitteredDelay(int retries, Duration baseDelay) {
  final delay = baseDelay.inMilliseconds * pow(2, retries);
  final jitter = Random().nextDouble() * delay;
  return Duration(milliseconds: (delay + jitter).toInt());
}