I recently had this code:
var concurrency = os.cpus.length;
function doWork(opts, cb) {
cb(null);
}
var queue = async.queue(doWork, concurrency);
Things queued never called the callback because os.cpus is a function that takes 0 arguments. Thus os.cpus.length returns 0 and the queue never does anything. The correct code would be os.cpus().length, notice the ().
Maybe it would be a good idea to throw an error to alert the user that the queue was initialised with 0 concurrency and thus never will run anything.
I recently had this code:
Things queued never called the callback because
os.cpusis a function that takes 0 arguments. Thusos.cpus.lengthreturns 0 and the queue never does anything. The correct code would beos.cpus().length, notice the().Maybe it would be a good idea to throw an error to alert the user that the queue was initialised with 0 concurrency and thus never will run anything.