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(internal/gensupport): add 408 to default retry #1397

Merged
merged 3 commits into from Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-api-go-generator/gen.go
Expand Up @@ -2001,7 +2001,7 @@ func (meth *Method) generateCode() {
"which errors are considered retryable. By default, exponetial backoff will be" +
"applied using gax defaults, and the following errors are retried:" +
"\n\n" +
"- HTTP responses with codes 429, 502, 503, and 504." +
"- HTTP responses with codes 408, 429, 502, 503, and 504." +
"\n\n" +
"- Transient network errors such as connection reset and io.ErrUnexpectedEOF." +
"\n\n" +
Expand Down
6 changes: 5 additions & 1 deletion internal/gensupport/retry.go
Expand Up @@ -36,6 +36,10 @@ const (
// should be retried.
// https://cloud.google.com/storage/docs/json_api/v1/status-codes#standardcodes
statusTooManyRequests = 429

// statusRequestTimeout is returned by the storage API if the
// upload connection was broken. The request should be retried.
statusRequestTimeout = 408
)

// shouldRetry indicates whether an error is retryable for the purposes of this
Expand All @@ -46,7 +50,7 @@ func shouldRetry(status int, err error) bool {
if 500 <= status && status <= 599 {
return true
}
if status == statusTooManyRequests {
if status == statusTooManyRequests || status == statusRequestTimeout {
return true
}
if err == io.ErrUnexpectedEOF {
Expand Down
2 changes: 1 addition & 1 deletion storage/v1/storage-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.