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 2.2.3 to 2.2.4

7

CHANGELOG.md

@@ -0,1 +1,8 @@

v.2.2.4
=======
- Allow reusing certain redis connections.
[Changes](https://github.com/OptimalBits/bull/compare/v2.2.3...v2.2.4)
v.2.2.3

@@ -2,0 +9,0 @@ =======

11

lib/job.js

@@ -36,5 +36,2 @@ /*eslint-env node */

//
// TODO: events emission to be based on pubsub to make them global.
//
function addJob(queue, job){

@@ -172,3 +169,3 @@ var opts = job.opts;

this.returnvalue = returnValue || 0;
return scripts.moveToCompleted(this || 0, this.opts.removeOnComplete);
return scripts.moveToCompleted(this, this.opts.removeOnComplete);
};

@@ -183,3 +180,3 @@

}
return scripts.move(this || 0, src, target);
return scripts.move(this, src, target);
}

@@ -205,2 +202,6 @@

}
} else if(_this.opts.removeOnFail){
return _this.releaseLock().then(function(){
return _this.remove();
});
}

@@ -207,0 +208,0 @@ // If not, move to failed

@@ -99,6 +99,6 @@ /*eslint-env node */

function createClient() {
function createClient(type) {
var client;
if(_.isFunction(redisOptions.createClient)){
client = redisOptions.createClient();
client = redisOptions.createClient(type);
}else{

@@ -121,3 +121,3 @@ client = new redis(redisPort, redisHost, redisOptions);

//
this.client = createClient();
this.client = createClient('client');

@@ -149,3 +149,3 @@ getRedisVersion(this.client).then(function(version){

//
this.bclient = createClient();
this.bclient = createClient('block');

@@ -155,3 +155,3 @@ //

//
this.eclient = createClient();
this.eclient = createClient('subscriber');

@@ -707,9 +707,10 @@ this.delayTimer = null;

return job.moveToCompleted(data)
.then(function(){
return _this.distEmit('completed', job, data);
});
return job.moveToCompleted(data).then(function(){
return _this.distEmit('completed', job, data);
});
}
function handleFailed(err){
var error = err.cause || err; //Handle explicit rejection
// TODO: Should moveToFailed ensure the lock atomically in one of its Lua scripts?

@@ -729,4 +730,2 @@ // See https://github.com/OptimalBits/bull/pull/415#issuecomment-269744735

_this.processing--;
var error = err.cause || err; //Handle explicit rejection
}

@@ -733,0 +732,0 @@

{
"name": "bull",
"version": "2.2.3",
"version": "2.2.4",
"description": "Job manager",

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

@@ -55,2 +55,9 @@ Bull Job Manager

Roadmap:
--------
- Rate limiter for jobs.
- Parent-child jobs relationships.
Install:

@@ -267,3 +274,35 @@ --------

Reusing Redis connections
-------------------------
A standard queue requires 3 connections to a redis server. In some situations when having many queues, and using
services such as Heroku where number of connections is limited, it is desirable to reuse some connections.
This can be achieved using the "createClient" option in the queue constructor:
```js
var client, subscriber;
client = new redis();
subscriber = new redis();
var opts = {
redis: {
opts: {
createClient: function(type){
switch(type){
case 'client':
return client;
case 'subscriber':
return subscriber;
default:
return new redis();
}
}
}
}
}
var queueFoo = new Queue('foobar', opts);
var queueQux = new Queue('quxbaz', opts);
```
Useful patterns

@@ -469,3 +508,6 @@ ---------------

removeOnComplete: boolean; // If true, removes the job when it successfully
// completes. Default behavior is to keep the job in the completed queue.
// completes. Default behavior is to keep the job in the completed set.
removeOnFail: boolean; // If true, removes the job when it fails after all attempts.
// Default behavior is to keep the job in the failed set.
}

@@ -712,3 +754,13 @@ ```

---------------------------------------
<a name="promote"/>
#### Job##promote
```ts
promote(): Promise
```
Promotes a job that is delayed to be placed on the wait state and executed as soon as
possible.
---------------------------------------

@@ -715,0 +767,0 @@

Sorry, the diff of this file is too big to display

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