Skip to content

Instantly share code, notes, and snippets.

@matthewstokeley
Last active March 6, 2020 18:26
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 matthewstokeley/0f354ff01a21716c656a76845e0d6772 to your computer and use it in GitHub Desktop.
Save matthewstokeley/0f354ff01a21716c656a76845e0d6772 to your computer and use it in GitHub Desktop.
// RDD-inspired replication with node
const createQueue (nodeServices) => {
const q = new Set()
for (var value of nodeServices) {
q.add(value)
}
return q;
}
let queue = createQueue(nodeService);
// ...
events.on('accumulator request', data, function() {
var nodeWorker = queue.next,
// run the function and store the data
// in this service
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment