diff --git a/examples/retry.js b/examples/retry.js index 6b6b3ebc..645fbf86 100644 --- a/examples/retry.js +++ b/examples/retry.js @@ -35,10 +35,8 @@ var jobs = { }, }, perform: function(a,b,callback){ - var broken = true; - - if(broken){ - return callback(new Error('BUSTED')); + if(a < 0){ + return callback(new Error('NEGATIVE NUMBERS ARE HARD :(')); }else{ return callback(null, (a + b)); } @@ -99,4 +97,5 @@ var queue = new NR.queue({connection: connectionDetails}, jobs); queue.on('error', function(error){ console.log(error); }); queue.connect(function(){ queue.enqueue('math', "add", [1,2]); + queue.enqueue('math', "add", [-1,2]); }); diff --git a/lib/plugins/retry.js b/lib/plugins/retry.js index 58d6f1ac..3f452d5c 100644 --- a/lib/plugins/retry.js +++ b/lib/plugins/retry.js @@ -121,7 +121,7 @@ retry.prototype.after_perform = function(callback){ var self = this; if(!self.worker.error){ - self.cleanup(callback); + return self.cleanup(callback); } self.attemptUp(function(error, remaning){ diff --git a/package.json b/package.json index d0396bcc..a4848066 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "node-resque", "description": "an opinionated implementation of resque in node", "license": "Apache-2.0", - "version": "2.0.1", + "version": "2.0.2", "homepage": "http://github.com/taskrabbit/node-resque", "repository": { "type": "git",