https://github.com/bitfinexcom/lokue
LokiJS Job Queue
https://github.com/bitfinexcom/lokue
Last synced: 11 months ago
JSON representation
LokiJS Job Queue
- Host: GitHub
- URL: https://github.com/bitfinexcom/lokue
- Owner: bitfinexcom
- Created: 2017-04-26T09:57:29.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-08T09:51:30.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T06:18:05.816Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://www.bitfinex.com
- Size: 9.77 KB
- Stars: 5
- Watchers: 7
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lokue: LokiJS Job Queue
Simple [LokiJS](http://lokijs.org/) Job Queue management
### Features
* Persist to file
* Fast (configurable concurrency)
* Small library
### Example
```
const Lokue = require('lokue')
const lok = new Lokue({
name: 'lokue-test.json',
persist: true,
concurrency: 10,
timeout_save: 50,
timeout_save: 100
})
lok.init((err) => {
let ix = 0
setInterval(() => {
ix++
lok.addJob({ hello: 'world' + ix })
}, 100)
})
lok.on('job', job => {
console.log('processing', job.data)
job.done()
})
setInterval(() => {
if (lok.isReady()) {
lok.requeueStuckJobs()
lok.clearCompletedJobs()
}
}, 1000)
process.on('SIGINT', () => {
if (lok.isReady()) {
lok.stop(() => {
console.log('saved')
process.exit()
})
} else {
process.exit()
}
})
```
### Contributors
* Paolo Ardoino /