Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-26 committed Oct 28, 2015
1 parent 19f0d0f commit 259c26c
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,28 +929,23 @@
_insert(q, data, true, callback);
},
process: function () {
if (!q.paused && workers < q.concurrency && q.tasks.length) {
while(workers < q.concurrency && q.tasks.length){
if (q.paused) {
return;
}
while(!q.paused && workers < q.concurrency && q.tasks.length){

var tasks = q.payload ?
q.tasks.splice(0, q.payload) :
q.tasks.splice(0, q.tasks.length);
var tasks = q.payload ?
q.tasks.splice(0, q.payload) :
q.tasks.splice(0, q.tasks.length);

var data = _map(tasks, function (task) {
return task.data;
});
var data = _map(tasks, function (task) {
return task.data;
});

if (q.tasks.length === 0) {
q.empty();
}
workers += 1;
workersList.push(tasks[0]);
var cb = only_once(_next(q, tasks));
worker(data, cb);
if (q.tasks.length === 0) {
q.empty();
}
workers += 1;
workersList.push(tasks[0]);
var cb = only_once(_next(q, tasks));
worker(data, cb);
}
},
length: function () {
Expand Down

0 comments on commit 259c26c

Please sign in to comment.