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

Gracefully handle short lived outages by holding RPC calls #2175

Merged
merged 3 commits into from
Jul 11, 2016
Merged

Conversation

armon
Copy link
Member

@armon armon commented Jul 10, 2016

This PR modifies the RPC forwarding behavior from a fast-fail in the case there is no known leader, to adding a small hold period. In the case of a short lived outage, this will cause RPCs to return successfully. In the case of a long lived outage, the call will still error out in a reasonable time. It also prevents callers who have while-true retry logic from abusing the system.

@armon
Copy link
Member Author

armon commented Jul 10, 2016

cc: @slackpad @sean-

return false, nil

// Gate the request until there is a leader
if firstCheck.IsZero() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just set firstCheck to time.Now() above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nano-optimization.

@slackpad
Copy link
Contributor

@armon this looks great! One tiny comment and it would be good to add a unit test for this :-)

@slackpad slackpad merged commit c6ef1d8 into master Jul 11, 2016
@slackpad slackpad deleted the f-hold-rpc branch July 11, 2016 22:43
slackpad pushed a commit that referenced this pull request Jul 11, 2016
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.

None yet

2 participants