diff --git a/lib/multiWorker.js b/lib/multiWorker.js index ca9b6d28..69afe5db 100644 --- a/lib/multiWorker.js +++ b/lib/multiWorker.js @@ -170,7 +170,7 @@ multiWorker.prototype.cleanupWorker = function(worker){ }); if(self.options.toDisconnectProcessors === true){ - worker.connection.redis.quit(); + worker.connection.disconnect(); } }; diff --git a/lib/queue.js b/lib/queue.js index cefcd427..8429317a 100644 --- a/lib/queue.js +++ b/lib/queue.js @@ -23,7 +23,7 @@ var queue = function(options, jobs, callback){ queue.prototype.end = function(callback){ var self = this; - self.connection.redis.quit(); + self.connection.disconnect(); process.nextTick(function(){ if(typeof callback === 'function'){ callback(); } }); diff --git a/lib/scheduler.js b/lib/scheduler.js index 1f0e50de..793e5fa6 100644 --- a/lib/scheduler.js +++ b/lib/scheduler.js @@ -53,9 +53,12 @@ scheduler.prototype.end = function(callback) { self.running = false; if(self.processing === false){ clearTimeout(self.timer); - self.emit('end'); - process.nextTick(function(){ - if(typeof callback === 'function'){ callback(); } + self.queue.end(function() { + self.emit('end'); + self.connection.disconnect(); + process.nextTick(function(){ + if(typeof callback === 'function'){ callback(); } + }); }); }else if(self.processing === true){ setTimeout(function(){ diff --git a/lib/worker.js b/lib/worker.js index 0fd07380..ba40d990 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -67,8 +67,10 @@ worker.prototype.end = function(callback) { }, self.options.timeout); }else{ self.untrack(self.name, self.stringQueues(), function(){ - self.emit('end'); - if(typeof callback === 'function'){ callback(); } + self.queueObject.end(function() { + self.emit('end'); + if(typeof callback === 'function'){ callback(); } + }); }); } };