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

Retry http request when unexpected error occurs #97

Merged
merged 4 commits into from Jul 13, 2017
Merged

Retry http request when unexpected error occurs #97

merged 4 commits into from Jul 13, 2017

Conversation

serihiro
Copy link
Contributor

What will this PR change?

  • implement Retry fetch_access_token! if connection fails #89
    • retry when request failed or timeout in GCECredentials#fetch_access_token and UserRefreshCredentials#revoke!
    • when give up retrying, raise Signet::AuthorizationError with the string of original_error.inpsect

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Feb 25, 2017
@serihiro
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Feb 25, 2017
@serihiro
Copy link
Contributor Author

@blowmage
Could you review this? I implemented for this issue #89 which you wrote.

Copy link
Contributor

@blowmage blowmage left a comment

Choose a reason for hiding this comment

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

Looks great!


if retry_count > 0
retry_count -= 1
retry

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@serihiro
Copy link
Contributor Author

@blowmage
Thank you fore your feedback. I fixed retry_with_error method and squashed into 960cac2 .
Travis CI job was failed for rubocop error, but I confirmed all specs were passed in my env(ruby 2.3.3p222).

@hxiong388
Copy link
Contributor

@serihiro Thanks for submitting this PR.

Our team has recently taken over the ownership of this repository, and I'm in process of triaging the PRs and issues. I'll merge this PR once you can fix the rubocop violations.

when 404
raise(Signet::AuthorizationError, NO_METADATA_SERVER_ERROR)
else
msg = "Unexpected error code #{resp.status}" + UNEXPECTED_ERROR_SUFFIX

This comment was marked as spam.

begin
yield
rescue => e
raise e if e.is_a?(Signet::AuthorizationError) || e.is_a?(Signet::ParseError)

This comment was marked as spam.

@coveralls
Copy link

coveralls commented Jul 13, 2017

Coverage Status

Coverage increased (+0.03%) to 98.443% when pulling 227ba09 on serihiro:retry-request-with-unexpected-error into 0f7fe1e on google:master.

@serihiro
Copy link
Contributor Author

@hxiong388
I fixed rubocop violations and rebased master branch.
Could you check this again?

@hxiong388 hxiong388 merged commit 8665196 into googleapis:master Jul 13, 2017
@hxiong388
Copy link
Contributor

@serihiro Thanks! Looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants