From 8add055936962ccb386e34376d453e8e1d8be903 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 13 Feb 2023 14:18:36 +0000 Subject: [PATCH] Stop ReadFromWithConcurrency sending more data than it needs to It was discovered that the ReadFrom method for uploading files in pkg/sftp was sending more data than it needed to. This was tracked down to the ReadFromWithConcurrency method forgetting to truncate the packets it was sending to the size Read. This was giving the remote server more work to do as it was writing and re-writing parts of a file. See: https://github.com/rclone/rclone/issues/6763 --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 1399583e..975bb7a4 100644 --- a/client.go +++ b/client.go @@ -1674,7 +1674,7 @@ func (f *File) ReadFromWithConcurrency(r io.Reader, concurrency int) (read int64 Handle: f.handle, Offset: uint64(off), Length: uint32(n), - Data: b, + Data: b[:n], }) select {