Skip to content

Commit

Permalink
ensure proper conditions for queue.drain(). fixes #668
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Early committed Jun 1, 2015
1 parent 4547ee9 commit 10c1d67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 10c1d67

Please sign in to comment.