diff --git a/lib/kue.js b/lib/kue.js index 533bf20c..69f691c7 100755 --- a/lib/kue.js +++ b/lib/kue.js @@ -248,6 +248,9 @@ Queue.prototype.checkActiveJobTtl = function( ttlOptions ) { }, 1000 ); ids.forEach(function( id ) { + // delete ttl exceeded job from active set befored failed + client.zrem(client.getKey('jobs:active'), id, function (err, count) { + }); id = client.stripFIFO(id); events.emit(id, 'ttl exceeded'); }); diff --git a/test/tdd/kue.spec.js b/test/tdd/kue.spec.js index 2a3cb054..7eda3e10 100644 --- a/test/tdd/kue.spec.js +++ b/test/tdd/kue.spec.js @@ -209,7 +209,8 @@ describe('Kue', function () { client = { zrangebyscore: sinon.stub().callsArgWith(6, null, ids), getKey: sinon.stub().returnsArg(0), - stripFIFO: sinon.stub().returnsArg(0) + stripFIFO: sinon.stub().returnsArg(0), + zrem: sinon.stub().returnsArg(0) }; job = { failedAttempt: sinon.stub().callsArg(1)