Retry failed client requests#1562
Merged
Merged
Conversation
In situations when the client fails with certain error codes, it should be able to retry the request. Ideally, it would retry the request to a different host so that in the event that an instance malfunctioned or was removed, the request wasn't consistently failing.
Contributor
|
The guava retrying looks pretty straightforward. Some things to keep in mind:
|
In particular, make retry more configurable by allowing the user to set the number of attempts and the strategy to determine whether a response should be retried. Also explicitly disabled retries on the request, so that it would be entirely handled within the Guava retryer. The reason that retries within the HttpClient can't be re-used is that doing so would just retry the given HttpRequest, and this needs to be able to alter the HttpRequest between attempts. Also is a little more careful about retrying to different hosts on requests.
ssalinas
reviewed
Jun 20, 2017
Contributor
ssalinas
left a comment
There was a problem hiding this comment.
Overall this looks good to me. Not sure of the best way to test it out, but we can merge it to hs_staging branches for some internal services to try
I was doing something that looked like ``` url = hostToUrl(host) actualUrl = hostToUrl(url) ``` which was very obviously wrong. This fixes it so that it only builds the URL once, which is the correct write way to do this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In situations when the client fails with certain error codes,
it should be able to retry the request. Ideally, it would
retry the request to a different host so that in the event that
an instance malfunctioned or was removed, the request wasn't
consistently failing.
/cc @ssalinas