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

azureblob: fix double accounting for multipart uploads - fixes #8718

Nick Craig-Woode6470d998cf0
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 2f7c8c927..71166f3b3 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -51,6 +51,7 @@ import (
"github.com/rclone/rclone/lib/env"
"github.com/rclone/rclone/lib/multipart"
"github.com/rclone/rclone/lib/pacer"
+ "github.com/rclone/rclone/lib/pool"
"golang.org/x/sync/errgroup"
)
@@ -2670,6 +2671,13 @@ func (w *azChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
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(2)
+ }
+
// Upload the block, with MD5 for check
m := md5.New()
currentChunkSize, err := io.Copy(m, reader)