Retry a promise with a heartbeat.
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
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.