backoff function

PollStrategy backoff(
  1. num startingThrottleInMsec,
  2. num backoffFactor
)

Implementation

PollStrategy backoff(num startingThrottleInMsec, num backoffFactor) {
  return (
    Principal canisterId,
    RequestId requestId,
    RequestStatusResponseStatus status,
  ) {
    final c = Completer();
    Future.delayed(Duration(milliseconds: startingThrottleInMsec.toInt()), () {
      startingThrottleInMsec *= backoffFactor;
      c.complete();
    });
    return c.future;
  };
}