Commit 3e404258 authored by Manuel Astudillo's avatar Manuel Astudillo Committed by GitHub
Browse files

Merge pull request #393 from manast/1.1.3

fixed #384, #342 and 1.1.3 release
parents 8459ecf5 568343ff
develop 1.1.3 BRPOPLPUSH add-after-remove-repeatable add-code-of-conduct-1 assorted-fixes atomic-move avoid-repeatable-jobs-duplication-every-1003 better-check-closing-stalled-jobs better-disconnect-and-process-args-handling better-is-ready-handling chainable_events check-closing-queue-in-is-finished complete-failed-zsets dependabot/npm_and_yarn/minimist-1.2.8 dependabot/npm_and_yarn/qs-6.5.3 do-not-close-external-connections emit-waiting-delayed events-counter extra-test-870 feat/add-isPaused feat/add-obliterate-method fetch-next-job-on-completed fix-delay fix-issue-812 fix-progress-event fix/958-finished-slowdown fix/better-delay-jobs-handling fix/better-rate-limiting fix/fix-typescript-processors fix/noscript fix/obliterate-many-jobs fix/properly-remove-sandbox-events fix/safer-obliterate fix/upgrade-lodash-to-avoid-vulnerability fixed-repeatable-job-remove github/fork/ASWATFZLLC/buffer github/fork/HugoPoi/develop github/fork/Thore1954/fix-repeat-limit-reset github/fork/dawiss1337/master github/fork/mamousavi/fix/add-missing-keys-to-repeat-opts github/fork/rysi3k/taking_lock_with_force global-stalled marshall007-cache_scripts master multiple-cron native-promises next performance-fixes rate-limiter repeatable-jobs returnvalue-not-populated-579 revert-460-create_client sanitized-options script-events store_process_timestamp threaded-process throw-error-if-invalid-processor-file update-job-data v3-docs v3.0.0 winds_sponsoring zset_repeatable_jobs 3.0.0-rc.4 3.0.0-rc.1 3.0.0-alpha.4 3.0.0-alpha.3 3.0.0-alpha.2 v4.10.4 v4.10.3 v4.10.2 v4.10.1 v4.10.0 v4.9.0 v4.8.5 v4.8.4 v4.8.3 v4.8.2 v4.8.1 v4.8.0 v4.7.0 v4.6.2 v4.6.1 v4.6.0 v4.5.6 v4.5.5 v4.5.4 v4.5.3 v4.5.2 v4.5.1 v4.5.0 v4.4.0 v4.3.0 v4.2.1 v4.2.0 v4.1.4 v4.1.3 v4.1.2 v4.1.1 v4.1.0 v4.0.0 v3.29.3 v3.29.2 v3.29.1 v3.29.0 v3.28.1 v3.28.0 v3.27.0 v3.26.0 v3.25.2 v3.25.1 v3.25.0 v3.24.0 v3.23.3 v3.23.2 v3.23.1 v3.23.0 v3.22.12 v3.22.11 v3.22.10 v3.22.9 v3.22.8 v3.22.7 v3.22.6 v3.22.5 v3.22.4 v3.22.3 v3.22.2 v3.22.1 v3.22.0 v3.21.1 v3.21.0 v3.20.1 v3.20.0 v3.19.1 v3.19.0 v3.18.1 v3.18.0 v3.17.0 v3.16.0 v3.15.0 v3.14.0 v3.13.0 v3.12.1 v3.12.0 v3.11.0 v3.10.0 v3.9.0 v3.8.1 v3.8.0 v3.7.0 v3.6.0 v3.5.3 v3.5.2 v3.5.1 v3.5.0 v3.4.8 v3.4.7 v3.4.6 v3.4.5 v3.4.4 v3.4.3 v3.4.2 v3.4.1 v3.4.0 v3.3.10 v3.3.9 v3.3.8 v3.3.7 v3.3.6 v3.3.5 v3.3.4 v3.3.3 v3.3.2 v3.3.1 v3.3.0 v3.2.0 v3.1.0 v3.0.0 v3.0.0-rc.10 v3.0.0-rc.9 v3.0.0-rc.8 v3.0.0-rc7 v.3.0.0-rc.6 v3.0.0-rc5 v3.0.0-rc.3 v3.0.0-rc.2 v3.0.0-alpha.1 v2.2.6 v2.2.5 v2.2.4 v2.2.3 v2.2.2 v2.2.1 v2.2.0 v2.1.2 v2.1.1 v2.1.0 v2.0.0 v1.1.3
No related merge requests found
Showing with 49 additions and 4 deletions
+49 -4
v.1.1.3
=======
- fixed "Broken constructor pattern from recent commit" #384
- fixed "Queue.prototype.getWaiting() returns empty list if Queue is paused" #342
[Changes](https://github.com/OptimalBits/bull/compare/v1.1.2...v1.1.3)
v1.1.2 v1.1.2
====== ======
......
...@@ -205,6 +205,12 @@ A queue emits also some useful events: ...@@ -205,6 +205,12 @@ A queue emits also some useful events:
}); });
``` ```
Events are by default local, i.e., they only fire on the listeners that are registered on the given worker,
if you need to listen to events globally, just set to true the last argument:
```
queue.on('completed', listener, true):
```
Queues are cheap, so if you need many of them just create new ones with different Queues are cheap, so if you need many of them just create new ones with different
names: names:
```javascript ```javascript
......
...@@ -70,7 +70,7 @@ var Queue = function Queue(name, redisPort, redisHost, redisOptions){ ...@@ -70,7 +70,7 @@ var Queue = function Queue(name, redisPort, redisHost, redisOptions){
redisHost = redisOpts.host; redisHost = redisOpts.host;
redisOptions = redisOpts.opts || {}; redisOptions = redisOpts.opts || {};
redisOptions.db = redisOpts.DB; redisOptions.db = redisOpts.DB;
} else if(arguments.length == 3) { } else if(parseInt(redisPort) == redisPort) {
redisPort = parseInt(redisPort); redisPort = parseInt(redisPort);
redisOptions = redisOptions || {}; redisOptions = redisOptions || {};
} else if(_.isString(redisPort)) { } else if(_.isString(redisPort)) {
...@@ -469,6 +469,9 @@ Queue.prototype.resume = function(isLocal /* Optional */){ ...@@ -469,6 +469,9 @@ Queue.prototype.resume = function(isLocal /* Optional */){
} }
}; };
//
// TODO: move to scripts module.
//
function pauseResumeGlobal(queue, pause){ function pauseResumeGlobal(queue, pause){
var src = 'wait', dst = 'paused'; var src = 'wait', dst = 'paused';
if(!pause){ if(!pause){
...@@ -798,7 +801,11 @@ Queue.prototype.getPausedCount = function() { ...@@ -798,7 +801,11 @@ Queue.prototype.getPausedCount = function() {
}; };
Queue.prototype.getWaiting = function(/*start, end*/){ Queue.prototype.getWaiting = function(/*start, end*/){
return this.getJobs('wait', 'LIST'); return Promise.join(
this.getJobs('wait', 'LIST'),
this.getJobs('paused', 'LIST')).spread(function(waiting, paused){
return _.concat(waiting, paused);
});
}; };
Queue.prototype.getActive = function(/*start, end*/){ Queue.prototype.getActive = function(/*start, end*/){
......
{ {
"name": "bull", "name": "bull",
"version": "1.1.2", "version": "1.1.3",
"description": "Job manager", "description": "Job manager",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
......
...@@ -250,6 +250,17 @@ describe('Queue', function () { ...@@ -250,6 +250,17 @@ describe('Queue', function () {
}); });
}); });
it('should create a queue with a prefix option', function () {
var queue = new Queue('q', 'redis://127.0.0.1', { keyPrefix: 'myQ' });
return queue.add({ foo: 'bar' }).then(function (job) {
expect(job.jobId).to.be.ok();
expect(job.data.foo).to.be('bar');
}).then(function () {
return queue.close();
});
});
}); });
describe(' a worker', function () { describe(' a worker', function () {
...@@ -1468,7 +1479,7 @@ describe('Queue', function () { ...@@ -1468,7 +1479,7 @@ describe('Queue', function () {
}); });
}); });
describe('Jobs getters', function () { describe.only('Jobs getters', function () {
var queue; var queue;
beforeEach(function () { beforeEach(function () {
...@@ -1491,6 +1502,19 @@ describe('Queue', function () { ...@@ -1491,6 +1502,19 @@ describe('Queue', function () {
}); });
}); });
it('should get paused jobs', function () {
return queue.pause().then(function () {
return Promise.join(queue.add({ foo: 'bar' }), queue.add({ baz: 'qux' })).then(function () {
return queue.getWaiting().then(function (jobs) {
expect(jobs).to.be.a('array');
expect(jobs.length).to.be.equal(2);
expect(jobs[1].data.foo).to.be.equal('bar');
expect(jobs[0].data.baz).to.be.equal('qux');
});
});
});
});
it('should get active jobs', function (done) { it('should get active jobs', function (done) {
queue.process(function (job, jobDone) { queue.process(function (job, jobDone) {
queue.getActive().then(function (jobs) { queue.getActive().then(function (jobs) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment