throttle function

PollStrategy throttle(
  1. int throttleMilliseconds
)

Throttle polling. @param throttleMilliseconds

  • Amount in millisecond to wait between each polling.

Implementation

PollStrategy throttle(int throttleMilliseconds) {
  return (
    Principal canisterId,
    RequestId requestId,
    RequestStatusResponseStatus status,
  ) async {
    final c = Completer();
    Future.delayed(Duration(milliseconds: throttleMilliseconds), c.complete);
    return c.future;
  };
}