From 3f0bec2ee9391e6eff34e6021971b6269285e3d1 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 26 Mar 2023 20:36:48 +0000 Subject: [PATCH] webdav: make pacer minSleep configurable This adds the config argument --webdav-pacer-min-sleep which specifies the http-request rate limit. Lowering this from the default 10ms can greatly improve performance when synchronizing small files. See: https://forum.rclone.org/t/webdav-with-persistent-connections/37024/10 --- backend/webdav/webdav.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go index dbccaeb25..cc714d826 100644 --- a/backend/webdav/webdav.go +++ b/backend/webdav/webdav.go @@ -43,7 +43,7 @@ import ( ) const ( - minSleep = 10 * time.Millisecond + minSleep = fs.Duration(10 * time.Millisecond) maxSleep = 2 * time.Second decayConstant = 2 // bigger for slower decay, exponential defaultDepth = "1" // depth for PROPFIND @@ -128,6 +128,11 @@ You can set multiple headers, e.g. '"Cookie","name=value","Authorization","xxx"' `, Default: fs.CommaSepList{}, Advanced: true, + }, { + Name: "pacer_min_sleep", + Help: "Minimum time to sleep between API calls.", + Default: minSleep, + Advanced: true, }, { Name: "nextcloud_chunk_size", Help: `Nextcloud upload chunk size. @@ -153,6 +158,7 @@ type Options struct { BearerTokenCommand string `config:"bearer_token_command"` Enc encoder.MultiEncoder `config:"encoding"` Headers fs.CommaSepList `config:"headers"` + PacerMinSleep fs.Duration `config:"pacer_min_sleep"` ChunkSize fs.SizeSuffix `config:"nextcloud_chunk_size"` } @@ -430,7 +436,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e opt: *opt, endpoint: u, endpointURL: u.String(), - pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))), + pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(opt.PacerMinSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))), precision: fs.ModTimeNotSupported, }