a queue that runs workers asynchronously in child processes
Async-ForkQueue is based on ForkQueue, but it allows setting a level of concurrency where each forked process will run that many at a time and provides a api for creating worker functions.
npm install async-forkqueue
var Queue = require'async-forkqueue';var num_workers = 4;var concurrency = 4;var queue = num_workers concurrency module_pathfor var i = 0; i < 100; i++queuepushi;queueendcallback;
Worker modules are spawned with child_process.fork.
A simple worker is below.
// Do something with the payloadcb