better-queue
Advanced tools
Comparing version 3.6.1 to 3.6.2
@@ -361,2 +361,4 @@ var uuid = require('node-uuid'); | ||
var self = this; | ||
var emptyTicket = new Ticket(); | ||
ticket = ticket || emptyTicket; | ||
var isUUID = false; | ||
@@ -373,3 +375,5 @@ if (!taskId) { | ||
var tickets = (self._writing[taskId] && self._writing[taskId].tickets) || new Tickets(); | ||
tickets.push(ticket); | ||
if (ticket !== emptyTicket) { | ||
tickets.push(ticket); | ||
} | ||
@@ -560,3 +564,2 @@ // Add to queue | ||
} | ||
self._startBatch(batch, tickets, lockId); | ||
@@ -614,3 +617,5 @@ }); | ||
self.emit('task_retry', taskId, self._retries[taskId]); | ||
self._queueTask(taskId, batch[taskId], tickets[taskId]); | ||
setImmediate(function () { | ||
self._queueTask(taskId, batch[taskId], tickets[taskId]); | ||
}) | ||
} | ||
@@ -617,0 +622,0 @@ }) |
@@ -15,3 +15,13 @@ | ||
Tickets.prototype.push = function (ticket) { | ||
this.tickets.push(ticket); | ||
var self = this; | ||
if (ticket instanceof Tickets) { | ||
return ticket.tickets.forEach(function (ticket) { | ||
self.push(ticket) | ||
}) | ||
} | ||
if (ticket instanceof Ticket) { | ||
if (self.tickets.indexOf(ticket) === -1) { | ||
self.tickets.push(ticket); | ||
} | ||
} | ||
} | ||
@@ -18,0 +28,0 @@ |
{ | ||
"name": "better-queue", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "Better Queue for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/queue.js", |
@@ -292,3 +292,19 @@ var fs = require('fs'); | ||
it('failed task should not stack overflow', function (done) { | ||
var count = 0; | ||
var q = new Queue(function (n, cb) { | ||
count++ | ||
if (count > 2000) { | ||
cb(); | ||
done(); | ||
} else { | ||
cb('fail'); | ||
} | ||
}, { | ||
maxRetries: Infinity | ||
}) | ||
q.push(1); | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78224
2034