# qjobs

> qjobs is a simple and stupid queue job manager for nodejs

Latest version **1.2.0** (published 2018-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install qjobs
pnpm add qjobs
yarn add qjobs
bun add qjobs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-02-19 |
| First published | 2013-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.9 |
| Dependencies | 0 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Franck TABARY |
| Maintainers | franck34 |
| Keywords | queue, jobs, job, concurrency, control |

## Links

- npm: https://www.npmjs.com/package/qjobs
- Repository: https://github.com/franck34/qjobs
- Homepage: https://github.com/franck34/qjobs#readme
- Issues: https://github.com/franck34/qjobs/issues
- npm.io page: https://npm.io/package/qjobs

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2018-02-19
- 1.1.5 — 2016-08-17
- 1.1.4 — 2013-09-22
- 1.1.3 — 2013-06-29
- 1.1.2 — 2013-06-03
- 1.1.1 — 2013-06-03
- 1.1.0 — 2013-06-02
- 1.0.9 — 2013-06-02
- 1.0.8 — 2013-05-31
- 0.9.9 — 2013-05-27
- 0.9.8 — 2013-05-03
- 1.0.7 — 2013-04-24
- 1.0.6 — 2013-04-21
- 1.0.5 — 2013-04-21
- 1.0.4 — 2013-04-21
- … 4 more at https://npm.io/package/qjobs/versions

## README

[![Build Status](https://secure.travis-ci.org/franck34/qjobs.png)](http://travis-ci.org/franck34/qjobs)

**qjobs**
==================
***Efficient queue job manager module for nodejs.***

Features
--------------
* Concurrency limiter
* Dynamic queue, a job can be added while the queue is running
* Optional delay before continuing after max concurrency has been reached
* Support of pause/unpause
* Events emitter based: start, end, sleep, continu, jobStart, jobEnd
* Quick statistic function, so you can know where the queue is, at regular interval

For what it can be usefull ?
---------------------
Jobs which needs to run in parallels, but in a controled maner, example: 
* Network scanners
* Parallels monitoring jobs
* Images/Videos related jobs 


Compatibility :
------------------
* not tested with nodejs < 0.10


Examples
--------------------

(take a look at tests directory if you are looking for running samples)


```
var qjobs = new require('./qjobs');
                                
// My non blocking main job     
var myjob = function(args,next) {
    setTimeout(function() {
        console.log('Do something interesting here',args);
        next();
    },1000);
}

var q = new qjobs({maxConcurrency:10});

// Let's add 30 job to the queue
for (var i = 0; i<30; i++) {
    q.add(myjob,[i,'test '+i]);
}

q.on('start',function() {
    console.log('Starting ...');
});

q.on('end',function() {
    console.log('... All jobs done');
});

q.on('jobStart',function(args) {
    console.log('jobStart',args);
});

q.on('jobEnd',function(args) {

    console.log('jobend',args);

    // If i'm jobId 10, then make a pause of 5 sec

    if (args._jobId == 10) {
        q.pause(true);
        setTimeout(function() {
            q.pause(false);
        },5000);
    }
});

q.on('pause',function(since) {
    console.log('in pause since '+since+' milliseconds');
});

q.on('unpause',function() {
    console.log('pause end, continu ..');
});

q.run();

//q.abort() will empty jobs list

```

---
_Source: https://npm.io/package/qjobs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
