"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
ftp,sftp: Make --tpslimit apply - fixes #4906
Nick Craig-Woode77532852307
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.goindex a27fd267b..387ef1f78 100644--- a/backend/ftp/ftp.go+++ b/backend/ftp/ftp.go@@ -15,6 +15,7 @@ import ("github.com/jlaffaye/ftp""github.com/pkg/errors""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/accounting""github.com/rclone/rclone/fs/config""github.com/rclone/rclone/fs/config/configmap""github.com/rclone/rclone/fs/config/configstruct"@@ -258,6 +259,7 @@ func (f *Fs) getFtpConnection(ctx context.Context) (c *ftp.ServerConn, err errorif f.opt.Concurrency > 0 {f.tokens.Get()}+ accounting.LimitTPS(ctx)f.poolMu.Lock()if len(f.pool) > 0 {c = f.pool[0]diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.goindex 60be731b2..e7c93c775 100644--- a/backend/sftp/sftp.go+++ b/backend/sftp/sftp.go@@ -21,6 +21,7 @@ import ("github.com/pkg/errors""github.com/pkg/sftp""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/accounting""github.com/rclone/rclone/fs/config""github.com/rclone/rclone/fs/config/configmap""github.com/rclone/rclone/fs/config/configstruct"@@ -349,6 +350,7 @@ func (f *Fs) newSftpClient(conn *ssh.Client, opts ...sftp.ClientOption) (*sftp.C// Get an SFTP connection from the pool, or open a new onefunc (f *Fs) getSftpConnection(ctx context.Context) (c *conn, err error) {+ accounting.LimitTPS(ctx)f.poolMu.Lock()for len(f.pool) > 0 {c = f.pool[0]diff --git a/docs/content/docs.md b/docs/content/docs.mdindex 4590a26c4..2de1c664f 100644--- a/docs/content/docs.md+++ b/docs/content/docs.md@@ -1297,10 +1297,15 @@ facility is `DAEMON`.### --tpslimit float ###-Limit HTTP transactions per second to this. Default is 0 which is used-to mean unlimited transactions per second.+Limit transactions per second to this number. Default is 0 which is+used to mean unlimited transactions per second.-For example to limit rclone to 10 HTTP transactions per second use+A transaction is roughly defined as an API call; its exact meaning+will depend on the backend. For HTTP based backends it is an HTTP+PUT/GET/POST/etc and its response. For FTP/SFTP it is a round trip+transaction over TCP.++For example to limit rclone to 10 transactions per second use`--tpslimit 10`, or to 1 transaction every 2 seconds use `--tpslimit0.5`.@@ -1311,6 +1316,10 @@ banned or rate limited).This can be very useful for `rclone mount` to control the behaviour ofapplications using it.+This limit applies to all HTTP based backends and to the FTP and SFTP+backends. It does not apply to the local backend or the Tardigrade+backend.+See also `--tpslimit-burst`.### --tpslimit-burst int ###