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

fix(storage): retry io.ErrUnexpectedEOF #3957

Merged
merged 2 commits into from Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions storage/go110.go
Expand Up @@ -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 {
tritone marked this conversation as resolved.
Show resolved Hide resolved
return true
}
switch e := err.(type) {
case *googleapi.Error:
// Retry on 429 and 5xx, according to
Expand Down
2 changes: 2 additions & 0 deletions storage/go110_test.go
Expand Up @@ -19,6 +19,7 @@ package storage
import (
"context"
"errors"
"io"
"net/url"
"testing"

Expand All @@ -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 {
Expand Down