diff options
author | Alexander Early <aearly@fluid.com> | 2015-05-31 19:27:05 -0700 |
---|---|---|
committer | Alexander Early <aearly@fluid.com> | 2015-05-31 19:27:05 -0700 |
commit | 10c1d677b2727c88dca00c2a74440f7ad3adf2e2 (patch) | |
tree | c643402cfd2608614bd02dad5a3d74c649830bb1 | |
parent | 4547ee9a1aa7db2cf8494b19448e7f76a843ea3f (diff) | |
download | async-10c1d677b2727c88dca00c2a74440f7ad3adf2e2.tar.gz |
ensure proper conditions for queue.drain(). fixes #668
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/async.js | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b58368..3d67c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Bug Fixes: - `forever` will no longer stack overflow with a synchronous iterator (#622) - `eachLimit` and others limit functions will stop iterating once an error occurs (#754) - Always pass `null` in callbacks when there is no error (#439) +- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668) - Doc fixes (#766) diff --git a/lib/async.js b/lib/async.js index 4486ba0..ba90413 100644 --- a/lib/async.js +++ b/lib/async.js @@ -811,7 +811,7 @@ if (!_isArray(data)) { data = [data]; } - if(data.length === 0) { + if(data.length === 0 && q.idle()) { // call drain immediately if there are no tasks return async.setImmediate(function() { q.drain(); |