Skip to content

Instantly share code, notes, and snippets.

@vvo
Last active April 19, 2017 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvo/5eb82f19f061353080dd534ac3009a67 to your computer and use it in GitHub Desktop.
Save vvo/5eb82f19f061353080dd534ac3009a67 to your computer and use it in GitHub Desktop.
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