node-resque
Advanced tools
Comparing version 0.8.7 to 0.9.0
@@ -97,3 +97,4 @@ ///////////////////////// | ||
worker.on('success', function(queue, job, result){ console.log("job success " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("job failed " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('failure', function(queue, job, failure){ console.log("job failure " + queue + " " + JSON.stringify(job) + " >> " + failure); }) | ||
worker.on('error', function(queue, job, error){ console.log("error " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('pause', function(){ console.log("worker paused"); }) | ||
@@ -100,0 +101,0 @@ |
@@ -62,3 +62,4 @@ ///////////////////////// | ||
worker.on('success', function(queue, job, result){ console.log("job success " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("job failed " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('failure', function(queue, job, failure){ console.log("job failure " + queue + " " + JSON.stringify(job) + " >> " + failure); }) | ||
worker.on('error', function(queue, job, error){ console.log("error " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('pause', function(){ console.log("worker paused"); }) | ||
@@ -65,0 +66,0 @@ |
@@ -82,3 +82,4 @@ ///////////////////////// | ||
worker.on('success', function(queue, job, result){ console.log("job success " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("job failed " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('failure', function(queue, job, failure){ console.log("job failure " + queue + " " + JSON.stringify(job) + " >> " + failure); }) | ||
worker.on('error', function(queue, job, error){ console.log("error " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('pause', function(){ console.log("worker paused"); }) | ||
@@ -85,0 +86,0 @@ |
@@ -53,3 +53,4 @@ ///////////////////////// | ||
worker.on('success', function(queue, job, result){ console.log("job success " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("job failed " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('failure', function(queue, job, failure){ console.log("job failure " + queue + " " + JSON.stringify(job) + " >> " + failure); }) | ||
worker.on('error', function(queue, job, error){ console.log("error " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('pause', function(){ console.log("worker paused"); }) |
@@ -69,4 +69,4 @@ var os = require("os"); | ||
}else{ | ||
self.emit('end'); | ||
self.untrack(self.name, self.stringQueues(), function(){ | ||
self.emit('end'); | ||
if(typeof callback == "function"){ callback(); } | ||
@@ -150,3 +150,3 @@ }); | ||
if(returnCounter !== 1){ | ||
self.emit('error', self.queue, job, callbackError); | ||
self.emit('failure', self.queue, job, callbackError); | ||
}else if(toRun == false){ | ||
@@ -165,3 +165,3 @@ self.completeJob(null, false, callback); | ||
if(returnCounter !== 2){ | ||
self.emit('error', self.queue, job, callbackError); | ||
self.emit('failure', self.queue, job, callbackError); | ||
}else{ | ||
@@ -173,3 +173,3 @@ self.error = err; | ||
if(returnCounter !== 3){ | ||
self.emit('error', self.queue, job, callbackError); | ||
self.emit('failure', self.queue, job, callbackError); | ||
}else{ | ||
@@ -222,3 +222,3 @@ self.completeJob(result, true, callback); | ||
self.connection.redis.rpush(self.connection.key('failed'), JSON.stringify(self.failurePayload(err, job))); | ||
self.emit('error', self.queue, job, err); | ||
self.emit('failure', self.queue, job, err); | ||
}; | ||
@@ -225,0 +225,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "an opinionated implementation of resque in node", | ||
"version": "0.8.7", | ||
"version": "0.9.0", | ||
"homepage": "http://github.com/taskrabbit/node-resque", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -77,3 +77,4 @@ # node-resque | ||
worker.on('success', function(queue, job, result){ console.log("job success " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("job failed " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('failure', function(queue, job, failure){ console.log("job failure " + queue + " " + JSON.stringify(job) + " >> " + result); }) | ||
worker.on('error', function(queue, job, error){ console.log("error " + queue + " " + JSON.stringify(job) + " >> " + error); }) | ||
worker.on('pause', function(){ console.log("worker paused"); }) | ||
@@ -80,0 +81,0 @@ |
@@ -124,8 +124,8 @@ var specHelper = require(__dirname + "/../_specHelper.js").specHelper; | ||
it("will mark a job as failed", function(done){ | ||
var listener = worker.on('error', function(q, job, err){ | ||
var listener = worker.on('failure', function(q, job, failire){ | ||
q.should.equal(specHelper.queue); | ||
job.class.should.equal('badAdd'); | ||
err.message.should.equal('Blue Smoke'); | ||
failire.message.should.equal('Blue Smoke'); | ||
worker.removeAllListeners('error'); | ||
worker.removeAllListeners('failire'); | ||
done(); | ||
@@ -153,7 +153,7 @@ }); | ||
it('will not work jobs that are not defined', function(done){ | ||
var listener = worker.on('error', function(q, job, error){ | ||
var listener = worker.on('failure', function(q, job, failure){ | ||
q.should.equal(specHelper.queue); | ||
String(error).should.equal == "Error: No job defined for class 'somethingFake'"; | ||
String(failure).should.equal == "Error: No job defined for class 'somethingFake'"; | ||
worker.removeAllListeners('error'); | ||
worker.removeAllListeners('failure'); | ||
done(); | ||
@@ -183,3 +183,3 @@ }); | ||
var errorListener = worker.on('error', function(q, job, err){ | ||
var errorListener = worker.on('failure', function(q, job, err){ | ||
String(err).should.equal('Error: refusing to continue with job, multiple callbacks detected'); | ||
@@ -201,2 +201,4 @@ callbackCounts++; | ||
successCounter.should.equal(1); | ||
worker.removeAllListeners('success'); | ||
worker.removeAllListeners('failure'); | ||
done(); | ||
@@ -203,0 +205,0 @@ }; |
100971
2294
251