Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bull

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bull - npm Package Compare versions

Comparing version 3.4.6 to 3.4.7

lib/commands/removeJob-8.lua

7

CHANGELOG.md
Changelog
=========
v.3.4.7
-------
- Fixes to deal with removing correctly in priority queues #984
[Changes](https://github.com/OptimalBits/bull/compare/v3.4.6...v3.4.7)
v.3.4.6

@@ -5,0 +12,0 @@ -------

1

lib/queue.js

@@ -737,2 +737,3 @@ /*eslint-env node */

multi.del(this.toKey('delayed'));
multi.del(this.toKey('priority'));

@@ -739,0 +740,0 @@ return multi.exec().spread(function(waiting, paused) {

@@ -279,3 +279,12 @@ /**

var keys = _.map(
['active', 'wait', 'delayed', 'paused', 'completed', 'failed', jobId],
[
'active',
'wait',
'delayed',
'paused',
'completed',
'failed',
'priority',
jobId
],
function(name) {

@@ -282,0 +291,0 @@ return queue.toKey(name);

2

package.json
{
"name": "bull",
"version": "3.4.6",
"version": "3.4.7",
"description": "Job manager",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -94,2 +94,33 @@ /*eslint-env node */

describe('.add jobs on priority queues', function() {
it('add 4 jobs with different priorities', function() {
return queue
.add({ foo: 'bar' }, { jobId: '1', priority: 3 })
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '2', priority: 3 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '3', priority: 2 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '4', priority: 1 });
})
.then(function() {
return queue
.getWaiting()
.then(function(result) {
var waitingIDs = [];
result.forEach(function(element) {
waitingIDs.push(element.id);
});
return waitingIDs;
})
.then(function(waitingIDs) {
expect(waitingIDs.length).to.be.equal(4);
expect(waitingIDs).to.be.eql(['4', '3', '1', '2']);
});
});
});
});
describe('.update', function() {

@@ -218,2 +249,90 @@ it('should allow updating job data', function() {

describe('.remove on priority queues', function() {
it('remove a job with jobID 1 and priority 3 and check the new order in the queue', function() {
return queue
.add({ foo: 'bar' }, { jobId: '1', priority: 3 })
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '2', priority: 3 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '3', priority: 2 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '4', priority: 1 });
})
.then(function() {
return queue.getJob('1').then(function(job) {
return job.remove().then(function() {
return queue
.getWaiting()
.then(function(result) {
var waitingIDs = [];
result.forEach(function(element) {
waitingIDs.push(element.id);
});
return waitingIDs;
})
.then(function(waitingIDs) {
expect(waitingIDs.length).to.be.equal(3);
expect(waitingIDs).to.be.eql(['4', '3', '2']);
});
});
});
});
});
it('add a new job with priority 10 and ID 5 and check the new order (along with the previous 4 jobs)', function() {
return queue
.add({ foo: 'bar' }, { jobId: '1', priority: 3 })
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '2', priority: 3 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '3', priority: 2 });
})
.then(function() {
return queue.add({ foo: 'bar' }, { jobId: '4', priority: 1 });
})
.then(function() {
return queue.getJob('1').then(function(job) {
return job.remove().then(function() {
return queue
.getWaiting()
.then(function(result) {
var waitingIDs = [];
result.forEach(function(element) {
waitingIDs.push(element.id);
});
return waitingIDs;
})
.then(function(waitingIDs) {
expect(waitingIDs.length).to.be.equal(3);
expect(waitingIDs).to.be.eql(['4', '3', '2']);
return true;
})
.then(function() {
return queue
.add({ foo: 'bar' }, { jobId: '5', priority: 10 })
.then(function() {
return queue
.getWaiting()
.then(function(result) {
var waitingIDs = [];
result.forEach(function(element) {
waitingIDs.push(element.id);
});
return waitingIDs;
})
.then(function(waitingIDs) {
expect(waitingIDs.length).to.be.equal(4);
expect(waitingIDs).to.be.eql(['4', '3', '2', '5']);
});
});
});
});
});
});
});
});
describe('.retry', function() {

@@ -220,0 +339,0 @@ it('emits waiting event', function(cb) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc