Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j3k0/node-local-jobs
Prevent two runs of the same job in parallel.
https://github.com/j3k0/node-local-jobs
Last synced: 22 days ago
JSON representation
Prevent two runs of the same job in parallel.
- Host: GitHub
- URL: https://github.com/j3k0/node-local-jobs
- Owner: j3k0
- Created: 2015-02-27T11:47:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-02-27T11:54:30.000Z (over 9 years ago)
- Last Synced: 2024-04-08T00:24:14.188Z (7 months ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Local Jobs runner
Prevents running the same job multiple times, on the same worker.
## Install
```sh
npm install local-jobs
```## Usage
```js
var jobs = require("local-jobs");var wait = function(cb) {
console.log("doing wait");
setTimeout(cb, 1000);
};var waitDone = function() {
console.log("wait done");
};jobs.do("wait", wait, waitDone);
jobs.do("wait", wait, waitDone);
jobs.do("wait", wait, waitDone);
```Will run `wait` only once.
Will call `waitDone` three times.