Skip to content

Commit

Permalink
fix: Retry for http timeout error. Fixes #9271
Browse files Browse the repository at this point in the history
Signed-off-by: Jingkai Hung <[email protected]>
  • Loading branch information
jingkkkkai committed Aug 15, 2022
1 parent 1b252fd commit 08da828
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion workflow/artifacts/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/argoproj/argo-workflows/v3/errors"
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
errutil "github.com/argoproj/argo-workflows/v3/util/errors"
waitutil "github.com/argoproj/argo-workflows/v3/util/wait"
"github.com/argoproj/argo-workflows/v3/workflow/artifacts/common"
)
Expand All @@ -38,7 +39,7 @@ var (

// from https://github.com/googleapis/google-cloud-go/blob/master/storage/go110.go
func isTransientGCSErr(err error) bool {
if err == io.ErrUnexpectedEOF {
if err == io.ErrUnexpectedEOF || errutil.IsTransientErr(err) {
return true
}
switch e := err.(type) {
Expand Down
4 changes: 4 additions & 0 deletions workflow/artifacts/oss/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/argoproj/argo-workflows/v3/errors"
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
errutil "github.com/argoproj/argo-workflows/v3/util/errors"
waitutil "github.com/argoproj/argo-workflows/v3/util/wait"
"github.com/argoproj/argo-workflows/v3/workflow/artifacts/common"
wfcommon "github.com/argoproj/argo-workflows/v3/workflow/common"
Expand Down Expand Up @@ -250,6 +251,9 @@ func isTransientOSSErr(err error) bool {
if err == nil {
return false
}
if errutil.IsTransientErr(err) {
return true
}
if ossErr, ok := err.(oss.ServiceError); ok {
for _, transientErrCode := range ossTransientErrorCodes {
if ossErr.Code == transientErrCode {
Expand Down
3 changes: 2 additions & 1 deletion workflow/artifacts/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/argoproj/argo-workflows/v3/errors"
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
errutil "github.com/argoproj/argo-workflows/v3/util/errors"
waitutil "github.com/argoproj/argo-workflows/v3/util/wait"
artifactscommon "github.com/argoproj/argo-workflows/v3/workflow/artifacts/common"
"github.com/argoproj/argo-workflows/v3/workflow/common"
Expand Down Expand Up @@ -87,7 +88,7 @@ func loadS3Artifact(s3cli argos3.S3Client, inputArtifact *wfv1.Artifact, path st
return true, nil
}
if !argos3.IsS3ErrCode(origErr, "NoSuchKey") {
return !isTransientS3Err(origErr), fmt.Errorf("failed to get file: %v", origErr)
return !errutil.IsTransientErr(origErr), fmt.Errorf("failed to get file: %v", origErr)
}
// If we get here, the error was a NoSuchKey. The key might be an s3 "directory"
isDir, err := s3cli.IsDirectory(inputArtifact.S3.Bucket, inputArtifact.S3.Key)
Expand Down

0 comments on commit 08da828

Please sign in to comment.