Retrying made simple, easy, and async.
// Packagesconst retry =const fetch =await
- The supplied function can be
asyncor not. In other words, it can be a function that returns a
Promiseor a value.
- The supplied function receives two parameters
Functionyou can invoke to abort the retrying (bail)
Numberidentifying the attempt. The absolute first attempt (before any retries) is
optsare passed to
node-retry. Read its docs
retries: The maximum amount of times to retry the operation. Default is
factor: The exponential factor to use. Default is
minTimeout: The number of milliseconds before starting the first retry. Default is
maxTimeout: The maximum number of milliseconds between two retries. Default is
randomize: Randomizes the timeouts by multiplying with a factor between
2. Default is
onRetry: an optional
Functionthat is invoked after a new retry is performed. It's passed the
Errorthat triggered it as a parameter.