Skip to content

Commit

Permalink
Allows use of connection closed errors to be retryable
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Aug 11, 2020
1 parent f8f9d46 commit 4469a0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws/request/connection_reset_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ func isErrConnectionReset(err error) bool {
return false
}

if strings.Contains(err.Error(), "connection reset") ||
if strings.Contains(err.Error(), "use of closed network connection") ||
strings.Contains(err.Error(), "connection reset") ||
strings.Contains(err.Error(), "broken pipe") {
return true
}
Expand Down
4 changes: 4 additions & 0 deletions aws/request/connection_reset_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func TestSerializationErrConnectionReset_accept(t *testing.T) {
Err: errConnectionResetStub,
ExpectAttempts: 6,
},
"use of closed network connection": {
Err: errUseOfClosedConnectionStub,
ExpectAttempts: 6,
},
}

for name, c := range cases {
Expand Down
3 changes: 3 additions & 0 deletions aws/request/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ var (

// Generic connection reset error
errConnectionResetStub = errors.New("connection reset")

// use of closed network connection error
errUseOfClosedConnectionStub = errors.New("use of closed network connection")
)

type testData struct {
Expand Down

0 comments on commit 4469a0d

Please sign in to comment.