1
mirror of https://github.com/rclone/rclone synced 2024-08-01 23:20:00 +02:00

operations: Don't use multi-thread copy if the backend doesn't support it #6915

This commit is contained in:
Nick Craig-Wood 2023-05-09 17:40:58 +01:00
parent 72be80ddca
commit 46a323ae14
2 changed files with 10 additions and 1 deletions

View File

@ -28,11 +28,15 @@ func doMultiThreadCopy(ctx context.Context, f fs.Fs, src fs.Object) bool {
if ci.MultiThreadStreams <= 1 {
return false
}
// ...if the source doesn't support it
if src.Fs().Features().NoMultiThreading {
return false
}
// ...size of object is less than cutoff
if src.Size() < int64(ci.MultiThreadCutoff) {
return false
}
// ...source doesn't support it
// ...destination doesn't support it
dstFeatures := f.Features()
if dstFeatures.OpenWriterAt == nil {
return false

View File

@ -79,6 +79,11 @@ func TestDoMultiThreadCopy(t *testing.T) {
assert.True(t, doMultiThreadCopy(ctx, f, src))
srcFs.Features().IsLocal = false
assert.True(t, doMultiThreadCopy(ctx, f, src))
srcFs.Features().NoMultiThreading = true
assert.False(t, doMultiThreadCopy(ctx, f, src))
srcFs.Features().NoMultiThreading = false
assert.True(t, doMultiThreadCopy(ctx, f, src))
}
func TestMultithreadCalculateChunks(t *testing.T) {