Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

s3: fix accounting for multpart uploads

Nick Craig-Woodf992742404c2
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index c5ca85db7..18171904e 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -55,6 +55,7 @@ import (
"github.com/rclone/rclone/lib/encoder"
"github.com/rclone/rclone/lib/multipart"
"github.com/rclone/rclone/lib/pacer"
+ "github.com/rclone/rclone/lib/pool"
"github.com/rclone/rclone/lib/readers"
"github.com/rclone/rclone/lib/rest"
"github.com/rclone/rclone/lib/version"
@@ -5403,6 +5404,12 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
err := fmt.Errorf("invalid chunk number provided: %v", chunkNumber)
return -1, err
}
+ // Only account after the checksum reads have been done
+ if do, ok := reader.(pool.DelayAccountinger); ok {
+ // To figure out this number, do a transfer and if the accounted size is 0 or a
+ // multiple of what it should be, increase or decrease this number.
+ do.DelayAccounting(3)
+ }
// create checksum of buffer for integrity checking
// currently there is no way to calculate the md5 without reading the chunk a 2nd time (1st read is in uploadMultipart)