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

Export WaitForLeader on MetaStore #2931

Merged
merged 3 commits into from
Jun 11, 2015
Merged

Export WaitForLeader on MetaStore #2931

merged 3 commits into from
Jun 11, 2015

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Jun 11, 2015

This exported function can then be used by Services and
server-reporting, so those components don't make progress until the
cluster is ready.

@otoolep otoolep force-pushed the wait_for_leader branch 2 times, most recently from 67654ec to e91c34c Compare June 11, 2015 18:05
@otoolep
Copy link
Contributor Author

otoolep commented Jun 11, 2015

@benbjohnson @dgnorton

otoolep added 2 commits June 11, 2015 11:10
This exported function can then be used by Services and
server-reporting, so those components don't make progress until the
cluster is ready.
@otoolep
Copy link
Contributor Author

otoolep commented Jun 11, 2015

Green build.

@dgnorton
Copy link
Contributor

Would it work to WaitForLeader in one place somewhere in cmd/influxd/run and not do it in the services?

@otoolep
Copy link
Contributor Author

otoolep commented Jun 11, 2015

@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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@dgnorton
Copy link
Contributor

+1 on green

@benbjohnson
Copy link
Contributor

👍

otoolep added a commit that referenced this pull request Jun 11, 2015
Export WaitForLeader on MetaStore
@otoolep otoolep merged commit e89d2d8 into master Jun 11, 2015
@otoolep otoolep deleted the wait_for_leader branch June 11, 2015 20:26
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

Successfully merging this pull request may close these issues.

3 participants