-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Export WaitForLeader on MetaStore #2931
Conversation
67654ec
to
e91c34c
Compare
This exported function can then be used by Services and server-reporting, so those components don't make progress until the cluster is ready.
Green build. |
Would it work to |
@dgnorton -- I thought about that, but not all services might want to wait. I thought it was best to leave it on a service-by-service basis. |
// waitForLeader sleeps until a leader is found or a timeout occurs. | ||
func (s *Store) waitForLeader(timeout time.Duration) error { | ||
// WaitForLeader sleeps until a leader is found or a timeout occurs. | ||
func (s *Store) WaitForLeader(timeout time.Duration) error { | ||
// Begin timeout timer. | ||
timer := time.NewTimer(timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should check to see if there's already a leader before starting a polling loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, pushed up a change.
+1 on green |
👍 |
Export WaitForLeader on MetaStore
This exported function can then be used by Services and
server-reporting, so those components don't make progress until the
cluster is ready.