Skip to content

Commit

Permalink
replace stupid tasks splice call with shift
Browse files Browse the repository at this point in the history
  • Loading branch information
Caolan McMahon committed Jul 7, 2011
1 parent cbb0a42 commit f3aec61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/async.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/async.js
Expand Up @@ -560,7 +560,7 @@
}, },
process: function () { process: function () {
if (workers < q.concurrency && tasks.length) { if (workers < q.concurrency && tasks.length) {
var task = tasks.splice(0, 1)[0]; var task = tasks.shift();
if(q.empty && tasks.length == 0) q.empty(); if(q.empty && tasks.length == 0) q.empty();
workers += 1; workers += 1;
worker(task.data, function () { worker(task.data, function () {
Expand Down

0 comments on commit f3aec61

Please sign in to comment.