import { PromiseRepeater } from "https://deno.land/x/mandarinets@v2.3.2/plugins/promiseRepeater.ts";
This class serves a promise repeater which will re-try your promise until they are successfully resolved or the max attempt limit has been reached.
await new PromiseRepeater(promiseFunc).maxAttempts(5).start();
await new PromiseRepeater(promiseFunc).maxAttempts(5).delay(1000).start();
await new PromiseRepeater(promiseFunc).unlimitedAttempts().delay(1000).start();
Methods
private
sleep(timeoutMs: number): Promise<void>attempt(): Promise<any>
delay(delayBetweenAttemptsMs: number): PromiseRepeater
maxAttempts(attempts: number): PromiseRepeater
start(): Promise<any>
unlimitedAttempts(): PromiseRepeater