Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@beyonk/promise-retry

antony1.1kMIT0.1.1

Retry a promise if it times out, until max retries reached

promise, retry, promise-retry, timeout, retries

readme

Beyonk

Promise Retry

js-standard-style CircleCI

Retryable promise utility for the browser

Why

There are a few similar modules out there, mostly abandonware, few with tests.

Usage

Install the module:

npm install --save-dev @beyonk/promise-retry

Use it in your code:

// defaults
const retries = 5
const intervalBetweenRetries = 1000

const myFunction = async function () { ...blah }

retry(
  myFunction,
  retries,
  intervalBetweenRetries
)

Running Tests

npm test

Credits

  • Code adapted from this gist, and corrected.