1.0.31 • Published 4 years ago
@akindutire/zil-queue v1.0.31
zil-queue
A simple queuing engine that works on principle of FIFO, SJF, and multi priority scheduling algorithms
Installation
Use the package manager npm to install it.
npm install @akindutire/zil-queue --save
Dependency
- mongoose
Usage
const Queue = require('zil-queue')
//start the queue engine
// ['high', 'video', 'share', 'default'] is the multi priority list, task on the high queue will get executed before the video queue
new Queue(['high','video', 'share', 'default'], {useSJF: true, showQueueList: false})
const job1 = await Queue.add( 'video',
async (a, b, c, basePath) => {
const pkg = await import(basePath+'/example/exampleJob.js')
await pkg.run(a, b, c)
},
[
1,
2,
3,
process.cwd()
],
{maxRetry: 0, timeout: 5000}
)
console.log(job1) //{id: 20, hash: def343dfhhehu3hh4, pos: 8}
//To remove a job from a queue
await Queue.remove('def343dfhhehu3hh4') //true or false
Contribution
Pull requests are welcome, for major change please open an issue to discuss the change.
License
MIT
1.0.31
4 years ago
1.0.30
4 years ago
1.0.29
4 years ago
1.0.28
4 years ago
1.0.27
4 years ago
1.0.26
4 years ago
1.0.25
4 years ago
1.0.24
4 years ago
1.0.23
4 years ago
1.0.21
4 years ago
1.0.20
4 years ago
1.0.19
4 years ago
1.0.18
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago