Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unbecomingLeader flag to avoid race condition in unbecomeLeader(). #8

Closed
colmsnowplow opened this issue Oct 27, 2021 · 1 comment

Comments

@colmsnowplow
Copy link

It is possible for unbecomeLeader() to be called more than once. If it is called for a second time, while the first is waiting for the waitgroup to finish, then leaderLost will not be nil, and it will attempt to close the leaderLost channel for a second time, resulting in the app panicing.

We can resolve this by adding an unbecomingLeader flag to the client. If unbecomingLeader is true, we wait for it to become false before proceeding with the unbecomeLeader() function.

@colmsnowplow
Copy link
Author

Resolved in #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant