nbqueue
super simple queue module for executing async functions in node.js. nbqueue was created as a module for nodebee, a pure javascript database.
installation
npm install nbqueue
uses
limiting the number of functions being executed
when accessing large amounts of files asynchronously, bad things can happen. for example, take a directory with 20,000 files in it and try accessing them all at once.
with nbqueue you can set the maxProcesses to a sane amount, like 100, and it will execute a maximum of 100 functions at a time. functions added after the limit has been reached will execute as the previous functions finish up.
this is also crucial for maintaining a sane level of forked child processes.
var fs = var Queue = fs
executing async functions in order
setting maxProcesses to 1 will ensure only 1 function can be executed at a time.
queues within queues
queue up multiple sets of async functions, and let a the master queue know when they're all finished. here's a not very useful example:
var masterQueue = masterQueue masterQueue masterQueue