1.0.2 • Published 2 years ago

retry-machine v1.0.2

Weekly downloads
1,257
License
Apache-2.0
Repository
github
Last release
2 years ago

Retry Machine

Retry Promises

const { retry } = require('retry-machine');

async function run(count) {
  console.log(count);
}

async function failure(e, attempt) {
  console.error(e);
}

const runner = retry({ max: 5, delay: 1000, factor: 2 }, failure);
await runner(run, 1);

Optionally pass in a logger:

const { retry } = require('retry-machine');
const logger = require('./logger');

async function run(count) {
  console.log(count);
}

async function failure(e, attempt) {
  console.error(e);
}

const runner = retry({ max: 5, delay: 1000, factor: 2, logger }, failure);
await runner(run, 1);
1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

7 years ago