0.0.4 • Published 5 years ago

retryp v0.0.4

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

retryp

Provide a function to retry promise if encountering an error, and return promise.

Installation

$ npm install retryp or $ yarn add retryp

Usage

retryp(function, options)

The function is a promise, and it will be retried based of options provide if some error occurs.

The options argument is an object.

  • limit: The maximum amount of times to retry the operation. Default is 10.
  • interval: The number of milliseconds between two retries. Default is 1000.

Example

import retryp from 'retryp';
// var retryp = require('retryp').default;

// Simple example

const doSomethingAsync = async () => {
  // ...
};

try {
  await retryp(doSomethingAsync, options = { limit: 100, interval: 1000 });
} catch (err) {
  console.log(err);
}
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago

1.0.0

5 years ago