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

How should monitorLock behave in the case of an error? #922

Closed
highlyunavailable opened this issue May 8, 2015 · 1 comment
Closed

How should monitorLock behave in the case of an error? #922

highlyunavailable opened this issue May 8, 2015 · 1 comment

Comments

@highlyunavailable
Copy link
Contributor

I'm porting the Consul Go API to C# so that we can use it internally, and I noticed that monitorLock returns if there's an error doing kv.Get(sessionID). This feels like if there was a connection loss during a long poll, we could return from monitorLock but no longer be watching the k/v store to determine if we've lost leadership.

https://github.com/hashicorp/consul/blob/master/api/lock.go#L319-L321

Am I just reading the code wrong, or is this actually a possibility?

Also, what should the right answer be here if that's the case? Closing leaderCh in case of an error seems like it would force a re-acquire, which does seem correct, especially if they're using their same session.

@highlyunavailable
Copy link
Contributor Author

Nevermind, I read the defer calls incorrectly. The leadership channel will close in case of an error.

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