workersQueue
tasks queue for multiple workers, works with node@^4.x.x
howto
let { return resolve reject //do the heavy work in webworker/forked process };let { return resolve reject //do the heavy work in webworker/forked process };let queue = worker1 worker2; queue;queue;
all tasks will be distributed between free workers, and stack up in the pending queue
API
class:WorkersQueue -
queue.addTask(task) - Promise
Returns a promise that resolved as soon as task is done. If it fails - promise is rejected.
queue.pendingTasks - Array
The array of pending tasks, if workers are not handling the load.
queue.running - Array
The array of current workers statuses - [false, true, false]
means that first and last workers are free.