Skip to content
Permalink
Browse files
fix(storage): retry io.ErrUnexpectedEOF (#3957)
This error can be caused by network flakiness. We already retry
it in the apiary client logic for uploads, so we should retry
here as well.
  • Loading branch information
tritone committed Apr 19, 2021
1 parent 98a5598 commit f6590cdc26c8479be5df48949fa59f879e0c24fc
Showing with 6 additions and 0 deletions.
  1. +4 −0 storage/go110.go
  2. +2 −0 storage/go110_test.go
@@ -17,13 +17,17 @@
package storage

import (
"io"
"net/url"
"strings"

"google.golang.org/api/googleapi"
)

func shouldRetry(err error) bool {
if err == io.ErrUnexpectedEOF {
return true
}
switch e := err.(type) {
case *googleapi.Error:
// Retry on 429 and 5xx, according to
@@ -19,6 +19,7 @@ package storage
import (
"context"
"errors"
"io"
"net/url"
"testing"

@@ -43,6 +44,7 @@ func TestInvoke(t *testing.T) {
{2, &googleapi.Error{Code: 518}, nil},
{2, &googleapi.Error{Code: 599}, &googleapi.Error{Code: 428}},
{1, &url.Error{Op: "blah", URL: "blah", Err: errors.New("connection refused")}, nil},
{1, io.ErrUnexpectedEOF, nil},
} {
counter := 0
call := func() error {

0 comments on commit f6590cd

Please sign in to comment.