Skip to content

Commit

Permalink
saftey around queue shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Jul 15, 2016
1 parent 47c6f2c commit da894bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion initializers/resque.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ module.exports = {
self.queue.connect(callback);
},

stopQueue: function(callback){
if(api.resque.queue){ api.resque.queue.end(callback); }
else{ callback(); }
},

startScheduler: function(callback){
var self = this;
var scheduler = NR.scheduler;
Expand Down Expand Up @@ -142,7 +147,7 @@ module.exports = {
stop: function(api, next){
api.resque.stopScheduler(function(){
api.resque.stopMultiWorker(function(){
api.resque.queue.end(function(){
api.resque.stopQueue(function(){
next();
});
});
Expand Down

0 comments on commit da894bf

Please sign in to comment.