Skip to content

Commit

Permalink
Stop ReadFromWithConcurrency sending more data than it needs to
Browse files Browse the repository at this point in the history
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: rclone/rclone#6763
  • Loading branch information
ncw committed Feb 13, 2023
1 parent 2489717 commit 8add055
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8add055

Please sign in to comment.