-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hey,
The example confused me, so this is my attempt to make it more clear, is my clarification correct?
Thanks,
D
elect(opts, function(err, node) {
if (node.leader) {
console.log('Hooray! I am the leader!');
} else {
+ // you are not the leader, but might be elected at some later time.
node.on('leader', function() {
- console.log('I got elected as the leader!');
+ console.log('Old leader is down, and I was just elected as the leader!');
});
}
});Note that the example will not run out of the box because /my/service/path may not yet exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels