Skip to content

✨ setInterval for promises and async/sync functions. Support graceful shutdown and prevent multiple executions from overlapping in time.

License

Notifications You must be signed in to change notification settings

a179346/async-interval-job

Repository files navigation

⭕ async-interval-job ⭕

Documentation Documentation Documentation Maintenance License: MIT

setInterval for promises and async/sync functions.

  • Support graceful shutdown.
  • Prevent multiple executions from overlapping in time.

🔗 Link

📥 Install

npm i async-interval-job

🏆 Overview

image

📖 Usage

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 ...
}

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

🌟 Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 a179346.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator