diff options
author | Caolan McMahon <caolan.mcmahon@gmail.com> | 2014-03-28 12:41:10 +0000 |
---|---|---|
committer | Caolan McMahon <caolan.mcmahon@gmail.com> | 2014-03-28 12:41:10 +0000 |
commit | 191a5076bf4a9cb6ac87b1bf6e9d4eb0a13527d7 (patch) | |
tree | 5fb93d2e26634692c513ca9dd884b3a6d3c43b2f /lib | |
parent | 287cb65116c34f5fff1b953c6b9a95bce0a3dbde (diff) | |
parent | c2b098bb46c9c17bb901a91073dae461dfad7ca8 (diff) | |
download | async-191a5076bf4a9cb6ac87b1bf6e9d4eb0a13527d7.tar.gz |
Merge pull request #433 from tikonen/master
Queue calls drain if empty task list is pushed
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/async.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/async.js b/lib/async.js index c6ac74e..16240f8 100755 --- a/lib/async.js +++ b/lib/async.js @@ -678,6 +678,14 @@ if(data.constructor !== Array) { data = [data]; } + if(data.length == 0) { + // call drain immediately if there are no tasks + return async.setImmediate(function() { + if (q.drain) { + q.drain(); + } + }); + } _each(data, function(task) { var item = { data: task, |