diff options
Diffstat (limited to 'lib/async.js')
-rw-r--r-- | lib/async.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/async.js b/lib/async.js index baf5820..b5ba2ea 100644 --- a/lib/async.js +++ b/lib/async.js @@ -406,6 +406,7 @@ }); _forEach(keys, function (k) { + var fired = false; var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; var taskCallback = function (err) { if (err) { @@ -426,7 +427,7 @@ var ready = function () { return _reduce(requires, function (a, x) { return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); + }, true) && !fired; }; if (ready()) { task[task.length - 1](taskCallback, results); @@ -435,6 +436,7 @@ var listener = function () { if (ready()) { removeListener(listener); + fired = true; task[task.length - 1](taskCallback, results); } }; |