Skip to content

Commit

Permalink
storage: retry on temporary errors
Browse files Browse the repository at this point in the history
Fixes #1061.

Change-Id: Ia3e8071fe59949fa003bc287fbef4d5e611fb093
Reviewed-on: https://code-review.googlesource.com/30370
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jean de Klerk <deklerk@google.com>
  • Loading branch information
jba committed Jul 12, 2018
1 parent a21a809 commit 8007d26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions storage/go110.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func shouldRetry(err error) bool {
// Retry on 429 and 5xx, according to
// https://cloud.google.com/storage/docs/exponential-backoff.
return e.Code == 429 || (e.Code >= 500 && e.Code < 600)
case interface{ Temporary() bool }:
return e.Temporary()
default:
return false
}
Expand Down
2 changes: 2 additions & 0 deletions storage/not_go110.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func shouldRetry(err error) bool {
// Unfortunately the error type is unexported, so we resort to string
// matching.
return strings.Contains(e.Error(), "REFUSED_STREAM")
case interface{ Temporary() bool }:
return e.Temporary()
default:
return false
}
Expand Down

0 comments on commit 8007d26

Please sign in to comment.