Skip to content

Commit

Permalink
tweak retries and add time taken log
Browse files Browse the repository at this point in the history
  • Loading branch information
mjh1 committed Aug 12, 2024
1 parent bdd1bf3 commit 38ab542
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion catalyst-uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func run() int {
return 1
}

start := time.Now()
out, err := core.Upload(os.Stdin, uri, WaitBetweenWrites, *timeout, *storageFallbackURLs)
if err != nil {
glog.Errorf("Uploader failed for %s: %s", uri.Redacted(), err)
Expand All @@ -109,7 +110,7 @@ func run() int {
if out != nil {
respHeaders = out.UploaderResponseHeaders
}
glog.Infof("Uploader succeeded for %s. storageRequestID=%s Etag=%s", uri.Redacted(), respHeaders.Get("X-Amz-Request-Id"), respHeaders.Get("Etag"))
glog.Infof("Uploader succeeded for %s. storageRequestID=%s Etag=%s timeTaken=%vms", uri.Redacted(), respHeaders.Get("X-Amz-Request-Id"), respHeaders.Get("Etag"), time.Since(start).Milliseconds())
// success, write uploaded file details to stdout
if glog.V(5) {
err = json.NewEncoder(stdout).Encode(map[string]string{"uri": uri.Redacted()})
Expand Down
5 changes: 2 additions & 3 deletions core/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import (
"strings"
"time"

"golang.org/x/sync/errgroup"

"github.com/cenkalti/backoff/v4"
"github.com/golang/glog"
"github.com/livepeer/go-tools/drivers"
"golang.org/x/sync/errgroup"
)

type ByteCounter struct {
Expand All @@ -43,7 +42,7 @@ func NoRetries() backoff.BackOff {
}

func UploadRetryBackoff() backoff.BackOff {
return newExponentialBackOffExecutor(2*time.Minute, 5*time.Minute, 1*time.Hour)
return newExponentialBackOffExecutor(30*time.Second, 4*time.Minute, 15*time.Minute)
}

func SingleRequestRetryBackoff() backoff.BackOff {
Expand Down

0 comments on commit 38ab542

Please sign in to comment.