1.0.31 • Published 3 years ago

@akindutire/zil-queue v1.0.31

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

zil-queue

A simple queuing engine that works on principle of FIFO, SJF, and multi priority scheduling algorithms

GitHub repo size node-current (tag)

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

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago