summaryrefslogtreecommitdiff
path: root/lib/internal/queue.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/queue.js')
-rw-r--r--lib/internal/queue.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/queue.js b/lib/internal/queue.js
index e357447..5e8d4d7 100644
--- a/lib/internal/queue.js
+++ b/lib/internal/queue.js
@@ -55,9 +55,10 @@ export default function queue(worker, concurrency, payload) {
for (var i = 0, l = tasks.length; i < l; i++) {
var task = tasks[i];
+
var index = indexOf(workersList, task, 0);
if (index >= 0) {
- workersList.splice(index)
+ workersList.splice(index, 1);
}
task.callback.apply(task, arguments);
@@ -118,11 +119,11 @@ export default function queue(worker, concurrency, payload) {
for (var i = 0; i < l; i++) {
var node = q._tasks.shift();
tasks.push(node);
+ workersList.push(node);
data.push(node.data);
}
numRunning += 1;
- workersList.push(tasks[0]);
if (q._tasks.length === 0) {
q.empty();