Skip to content

Commit

Permalink
Merge pull request #762 from VitoNordloh/master
Browse files Browse the repository at this point in the history
intercept queue concurrency of 0. Fixes #714
  • Loading branch information
aearly committed May 20, 2015
2 parents f5c6331 + 562f879 commit facb5cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions test/test-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down

0 comments on commit facb5cf

Please sign in to comment.