0.0.1 • Published 7 months ago

heartbeat-retry v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

If I should maintain this repo, please ⭐️

DM me on Twitter if you have questions or suggestions.


npm install heartbeat-retry
yarn add heartbeat-retry
pnpm add heartbeat-retry
bun add heartbeat-retry

Usage

heartbeat-retry is built on p-retry, so it exposes the same options, in addition to heartbeat and onHeartbeat:

import retry from "heartbeat-retry";

retry(promise, {
  heartbeat: 10_000, // 10 seconds
  onHeartbeat: (elapsed: number) => {
    console.log("Heartbeat")
  },
  retries: 5,
  onFailedAttempt: (error) => {
    console.log("Failed attempt", error);
  }
});
  • p-retry: Retry a promise-returning or async function

MIT

0.0.1

7 months ago