Permalink
Browse files

Make sure parallel task return in order

  • Loading branch information...
tim-smart committed Jun 19, 2010
1 parent 2a3c55e commit 12dd098f762a5e8829482be5c1eb835b5d30eefe
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/parallel/index.js
View
@@ -98,12 +98,13 @@ Sequence.prototype.run = function run(callback) {
results = [],
error = null;
next.parallel = function parallel() {
- counter++;
+ var i = counter++;
return function () {
if (arguments[0]) {
error = arguments[0];
}
results.push(arguments[1]);
+ results[i + 1] = arguments[1];
counter--;
if (counter <= 0) {
results.unshift(results.slice());

0 comments on commit 12dd098

Please sign in to comment.