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

operations: ensure concurrency is no greater than the number of chunks - fixes #7299

Pat Patterson71f288356258
diff --git a/fs/operations/multithread.go b/fs/operations/multithread.go
index e4b75c62c..9b79e6fa1 100644
--- a/fs/operations/multithread.go
+++ b/fs/operations/multithread.go
@@ -172,17 +172,18 @@ func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object,
info.ChunkSize = src.Size()
}
+ // Use the backend concurrency if it is higher than --multi-thread-streams or if --multi-thread-streams wasn't set explicitly
+ if !ci.MultiThreadSet || info.Concurrency > concurrency {
+ fs.Debugf(src, "multi-thread copy: using backend concurrency of %d instead of --multi-thread-streams %d", info.Concurrency, concurrency)
+ concurrency = info.Concurrency
+ }
+
numChunks := calculateNumChunks(src.Size(), info.ChunkSize)
if concurrency > numChunks {
fs.Debugf(src, "multi-thread copy: number of streams %d was bigger than number of chunks %d", concurrency, numChunks)
concurrency = numChunks
}
- // Use the backend concurrency if it is higher than --multi-thread-streams or if --multi-thread-streams wasn't set explicitly
- if !ci.MultiThreadSet || info.Concurrency > concurrency {
- fs.Debugf(src, "multi-thread copy: using backend concurrency of %d instead of --multi-thread-streams %d", info.Concurrency, concurrency)
- concurrency = info.Concurrency
- }
if concurrency < 1 {
concurrency = 1
}