Skip to content

Instantly share code, notes, and snippets.

@vvo
Last active Apr 19, 2017
Embed
What would you like to do?
var workers = [
{name: 'worker1', fn: function(task, cb) {/* some async processing */}},
{name: 'worker2', fn: function(task, cb) {/* some async processing */ }}
];
var tasks = ['one']; // this will be filled with a first task and then filled with more tasks from the workers
// I want to distribute tasks to workers, each worker can process only one task at a time
// workers will add more tasks while processing
// in some situations tasks may be empty and all workers processing
// in some situations tasks will not be empty and all workers will be processing
// When there's one error, I just want to be notified
// Any module can be used, I am using Node.JS latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment