mirror of
https://github.com/rclone/rclone
synced 2024-11-05 01:42:31 +01:00
operations: Don't use multi-thread copy if the backend doesn't support it #6915
This commit is contained in:
parent
72be80ddca
commit
46a323ae14
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user