Skip to content

Commit 7f89650

Browse files
committed
fix: do not retry on http 404
1 parent acde213 commit 7f89650

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

server/download.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/flashbots/gh-artifacts-sync/logutils"
13+
"github.com/flashbots/gh-artifacts-sync/utils"
1314

1415
"go.uber.org/zap"
1516
)
@@ -38,6 +39,9 @@ func (s *Server) downloadUrl(
3839
res, err := cli.Do(req)
3940
if err == nil && res.StatusCode != http.StatusOK {
4041
err = fmt.Errorf("unexpected http status: %d", res.StatusCode)
42+
if res.StatusCode == http.StatusNotFound {
43+
err = utils.DoNotRetry(err)
44+
}
4145
}
4246
if err != nil {
4347
return fmt.Errorf("failed to execute http request: %w", err)

server/upload_gcp_docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (s *Server) uploadFromZipToGcpArtifactRegistryDocker(
8989

9090
transportErr := &crtransport.Error{}
9191
if errors.As(uploadErr, &transportErr) && !transportErr.Temporary() {
92-
uploadErr = utils.NoRetry(uploadErr)
92+
uploadErr = utils.DoNotRetry(uploadErr)
9393
}
9494

9595
return uploadErr

utils/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type NonRetryableError struct {
44
err error
55
}
66

7-
func NoRetry(err error) error {
7+
func DoNotRetry(err error) error {
88
return &NonRetryableError{err: err}
99
}
1010

0 commit comments

Comments
 (0)