heartbeat-retry
v0.0.1
Published
Retry a promise with a heartbeat
Downloads
3
Maintainers
Readme
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
- @autossey/eslint-config: A base for projects that use ESLint.
- @autossey/tsconfig: A base TSConfig for various project types.