8000 bump to 0.7.0 · JavaScriptExpert/kue@f440b7b · GitHub
[go: up one dir, main page]

Skip to content

Commit f440b7b

Browse files
committed
bump to 0.7.0
1 parent 5097b1d commit f440b7b

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

lib/kue.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports = module.exports = Queue;
2424
* Library version.
2525
*/
2626

27-
exports.version = '0.6.2';
27+
exports.version = '0.7.0';
2828

2929
/**
3030
* Expose `Job`.
@@ -61,9 +61,9 @@ exports.redis = redis;
6161
* @api public
6262
*/
6363

64-
exports.createQueue = function () {
64+
exports.createQueue = function ( options ) {
6565
if (!Queue.singleton) {
66-
Queue.singleton = new Queue();
66+
Queue.singleton = new Queue( options );
6767
}
6868
events.subscribe();
6969
return Queue.singleton;
@@ -81,10 +81,12 @@ exports.workers = [];
8181
* @api public
8282
*/
8383

84-
function Queue() {
85-
this.client = redis.createClient();
84+
function Queue( options ) {
85+
options = options || {};
86+
this.client = redis.createClient( options.redis );
8687
this.promoter = null;
8788
this.workers = exports.workers;
89+
this.disableSearch = options.disableSearch;
8890
}
8991

9092
/**

lib/queue/job.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Job.prototype.priority = function (level) {
363363
};
364364

365365
/**
366-
* Increment attemps, invoking callback `fn(remaining, attempts, max)`.
366+
* Increment attempts, invoking callback `fn(remaining, attempts, max)`.
367367
*
368368
* @param {Function} fn
369369
* @return {Job} for chaining
@@ -418,10 +418,12 @@ Job.prototype.remove = function (fn) {
418418
// console.log( "removeJob", this.id, err, replies );
419419
// events.remove(this);
420420
fn && fn(err);
421-
/*if( require('../kue').singleton.searchEnabled ){
422-
getSearch().remove(this.id, function(){
423-
});
424-
}*/
421+
// TODO bad smell: change singelton access!
422+
if( require('../kue').singleton.disableSearch ){
423+
getSearch().remove(this.id, function(){
424+
console.log( "remove index ", this.id, arguments );
425+
}.bind( this ));
426+
}
425427
// }.bind(this));
426428
}.bind(this));
427429
return this;
@@ -613,11 +615,12 @@ Job.prototype.update = function (fn) {
613615
this.state(this._state, fn);
614616
}.bind(this));
615617

616-
/*if( require('../kue').singleton.searchEnabled ) {
617-
// search data
618-
getSearch().index(json, this.id, function(){
619-
});
620-
}*/
618+
// TODO bad smell: change singelton access!
619+
if( require('../kue').singleton.disableSearch ) {
620+
getSearch().index(json, this.id, function(){
621+
console.log( "add index ", this.id, arguments );
622+
}.bind(this));
623+
}
621624
};
622625

623626
/**

lib/redis.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ var redis = require('redis');
1818
* @api private
1919
*/
2020

21-
exports.createClient = function () {
22-
return redis.createClient();
21+
exports.createClient = function ( options ) {
22+
var client;
23+
if( options ) {
24+
client = redis.createClient(
25+
options.port || 6379,
26+
options.host,
27+
options.options || {}
28+
);
29+
} else {
30+
client = redis.createClient();
31+
}
32+
client.on("error", function (err) {
33+
console.error( " 5235 Redis client error ", err );
34+
});
35+
return client;
2336
};
2437

2538
/**

0 commit comments

Comments
 (0)
0