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

feat(v2): add OnHTTPCodes CallOption #188

Merged
merged 2 commits into from
May 5, 2022

Conversation

noahdietz
Copy link
Contributor

This adds the OnHTTPCodes CallOption for configuring a Retryer to retry a set of HTTP status codes present in an error of type googleapi.Error.

@noahdietz noahdietz requested a review from a team as a code owner May 5, 2022 00:33
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

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

LGTM overall, just a couple of small things.

v2/call_option.go Outdated Show resolved Hide resolved
v2/call_option.go Outdated Show resolved Hide resolved
}

func (r *httpRetryer) Retry(err error) (time.Duration, bool) {
var gerr *googleapi.Error
Copy link
Member

Choose a reason for hiding this comment

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

Side note: Maybe we should do the work to wrap these with APIError so gax only opperates on this type directly...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean, can you elaborate? The main sticking point for me is that APIError doesn't have a Code property (we'd need to decide on a transport-agnostic Code type or align on gRPC Codes).

Copy link
Member

@codyoss codyoss May 5, 2022

Choose a reason for hiding this comment

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

Sorry, I mean in apiary-land we should consider starting to wrap those errors with APIError. I believe APIError has access to the raw googleapis.Error. Might make a PR to wrap things later...

@noahdietz noahdietz requested a review from codyoss May 5, 2022 16:04
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

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

Thanks!

@noahdietz noahdietz merged commit ba7c534 into googleapis:main May 5, 2022
@noahdietz noahdietz deleted the on-http-codes branch May 5, 2022 16:55
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.

2 participants