diff options
author | Vito Alexander Nordloh <vito.nordloh@vitonordloh.de> | 2015-05-20 23:22:52 +0200 |
---|---|---|
committer | Vito Alexander Nordloh <vito.nordloh@vitonordloh.de> | 2015-05-20 23:22:52 +0200 |
commit | 562f879df5f1fd2aa6d2b411e67357b78a9bc249 (patch) | |
tree | bcbd4e07d045797975e69fdcb51e5610cc5ac86c | |
parent | 138b0a2781a8404d55c72f4475fcd645b1c52af5 (diff) | |
download | async-562f879df5f1fd2aa6d2b411e67357b78a9bc249.tar.gz |
intercept queue concurrency of 0
-rw-r--r-- | lib/async.js | 3 | ||||
-rwxr-xr-x | test/test-async.js | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/async.js b/lib/async.js index 47ab5a7..81916fd 100644 --- a/lib/async.js +++ b/lib/async.js @@ -886,6 +886,9 @@ if (concurrency === undefined) { concurrency = 1; } + else if(concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } function _insert(q, data, pos, callback) { if (!q.started){ q.started = true; diff --git a/test/test-async.js b/test/test-async.js index 6f6a741..64c33f9 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -2453,6 +2453,13 @@ exports['queue default concurrency'] = function (test) { }; }; +exports['queue zero concurrency'] = function(test){ + test.throws(function () { + async.queue(function (task, callback) {}, 0); + }); + test.done(); +}; + exports['queue error propagation'] = function(test){ var results = []; |