You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Urgh, this is definitely a bug. I think the bug is here. That emit should only happen if the term is greater than the current term, not greater than or equal to, which is what it currently is.
I tried a few variations, but was unable to get the followers to emit leaderElected exactly once.
I also noticed that there are 2 other places in the code where leaderElected event can be emitted (line 429 and line 544 in addition to line 570 that you pointed out above).
I put together a little demo here
If I add a console.log statement in the leaderElected event handler, all followers spam that log statement even if the leader has not changed.
Perhaps there should be an event for the heartbeat, and a different event for a successful leader election.
The text was updated successfully, but these errors were encountered: