Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        


⭕ 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
+ [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)_