Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a179346/async-interval-job
✨ setInterval for promises and async/sync functions. Support graceful shutdown and prevent multiple executions from overlapping in time.
https://github.com/a179346/async-interval-job
async async-interval async-interval-job asynchronous await graceful graceful-shutdown interval javascript js node promise promises race race-condition repeat setinterval timer ts typescript
Last synced: about 2 months ago
JSON representation
✨ setInterval for promises and async/sync functions. Support graceful shutdown and prevent multiple executions from overlapping in time.
- Host: GitHub
- URL: https://github.com/a179346/async-interval-job
- Owner: a179346
- License: mit
- Created: 2022-09-30T16:37:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-01T15:20:55.000Z (about 2 years ago)
- Last Synced: 2024-10-22T15:40:44.998Z (2 months ago)
- Topics: async, async-interval, async-interval-job, asynchronous, await, graceful, graceful-shutdown, interval, javascript, js, node, promise, promises, race, race-condition, repeat, setinterval, timer, ts, typescript
- Language: TypeScript
- Homepage:
- Size: 122 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> setInterval for promises and async/sync functions.
>
> + __Support graceful shutdown.__
> + __Prevent multiple executions from overlapping in time.__## 🔗 Link
+ [Github](https://github.com/a179346/async-interval-job#readme)
+ [npm](https://www.npmjs.com/package/async-interval-job)## 📥 Install
```sh
npm i async-interval-job
```## 🏆 Overview
![image](https://github.com/a179346/async-interval-job/blob/main/flow/async-interval-job.png)
## 📖 Usage
```js
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](https://github.com/a179346/async-interval-job/issues).## 🌟 Show your support
Give a ⭐️ if this project helped you!
## 📝 License
Copyright © 2022 [a179346](https://github.com/a179346).
This project is [MIT](https://github.com/a179346/async-interval-job/blob/master/LICENSE) licensed.***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_