Skip to content

Commit b5fe903

Browse files
authored
feat(storage): retry on a HTTP 408 response code (#5314)
1 parent 3bd5995 commit b5fe903

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

storage/invoke.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ func shouldRetry(err error) bool {
6464
}
6565
switch e := err.(type) {
6666
case *googleapi.Error:
67-
// Retry on 429 and 5xx, according to
67+
// Retry on 408, 429, and 5xx, according to
6868
// https://cloud.google.com/storage/docs/exponential-backoff.
69-
return e.Code == 429 || (e.Code >= 500 && e.Code < 600)
69+
return e.Code == 408 || e.Code == 429 || (e.Code >= 500 && e.Code < 600)
7070
case *url.Error:
7171
// Retry socket-level errors ECONNREFUSED and ENETUNREACH (from syscall).
7272
// Unfortunately the error type is unexported, so we resort to string

storage/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ func (ws *withPolicy) apply(config *retryConfig) {
19001900
// By default, the following errors are retried (see invoke.go for the default
19011901
// shouldRetry function):
19021902
//
1903-
// - HTTP responses with codes 429, 502, 503, and 504.
1903+
// - HTTP responses with codes 408, 429, 502, 503, and 504.
19041904
//
19051905
// - Transient network errors such as connection reset and io.ErrUnexpectedEOF.
19061906
//

0 commit comments

Comments
 (0)