diff --git a/core/uploader.go b/core/uploader.go index df95b1a..8390dc4 100644 --- a/core/uploader.go +++ b/core/uploader.go @@ -73,11 +73,12 @@ func Upload(input io.Reader, outputURI *url.URL, waitBetweenWrites, writeTimeout return nil, fmt.Errorf("failed to read file") } - // To count how many bytes we are trying to read then write (upload) to s3 storage - teeReader := io.TeeReader(bytes.NewReader(fileContents), byteCounter) - var out *drivers.SaveDataOutput err = backoff.Retry(func() error { + // To count how many bytes we are trying to read then write (upload) to s3 storage + teeReader := io.TeeReader(bytes.NewReader(fileContents), byteCounter) + byteCounter.Reset() + out, err = session.SaveData(context.Background(), "", teeReader, fields, segmentWriteTimeout) if err != nil { glog.Errorf("failed upload attempt for %s (%d bytes): %v", outputURI.Redacted(), byteCounter.Count, err)