setInterval for promises and async/sync functions.
- Support graceful shutdown.
- Prevent multiple executions from overlapping in time.
npm i async-interval-job
import { AsyncIntervalJob } from 'async-interval-job';
const job = new AsyncIntervalJob(async () => {
// Execute for each interval.
}, 60 * 1000);
job.start();
async function gracefulShutdown() {
await job.stop();
// Can close the db connections here ...
}
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2022 a179346.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator