diff --git a/google-api-go-generator/gen.go b/google-api-go-generator/gen.go index 2e337c9e1d8..cf537f51dde 100644 --- a/google-api-go-generator/gen.go +++ b/google-api-go-generator/gen.go @@ -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" + diff --git a/internal/gensupport/retry.go b/internal/gensupport/retry.go index 4a4861b1b1a..cea725a3b16 100644 --- a/internal/gensupport/retry.go +++ b/internal/gensupport/retry.go @@ -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 @@ -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 { diff --git a/storage/v1/storage-gen.go b/storage/v1/storage-gen.go index 2ac105884c6..752b7a9e1e9 100644 --- a/storage/v1/storage-gen.go +++ b/storage/v1/storage-gen.go @@ -10276,7 +10276,7 @@ func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *Objec // By default, exponetial backoff will beapplied using gax defaults, and // the following errors are retried: // -// - HTTP responses with codes 429, 502, 503, and 504. +// - HTTP responses with codes 408, 429, 502, 503, and 504. // // - Transient network errors such as connection reset and // io.ErrUnexpectedEOF.