From 147f97d1f78aa473416ed2cae9ef6a9c99fd8065 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 15 May 2020 11:23:16 +0100 Subject: [PATCH] sync: allow --max-backlog to be -ve meaning as large as possible --- docs/content/docs.md | 3 +++ fs/sync/pipe.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/docs/content/docs.md b/docs/content/docs.md index f9cbd6ff1..8585fff74 100644 --- a/docs/content/docs.md +++ b/docs/content/docs.md @@ -745,6 +745,9 @@ time and make `--order-by` work more accurately. Setting this small will make rclone more synchronous to the listings of the remote which may be desirable. +Setting this to a negative number will make the backlog as large as +possible. + ### --max-delete=N ### This tells rclone not to delete more than N files. If that limit is diff --git a/fs/sync/pipe.go b/fs/sync/pipe.go index 08b40c740..d618ce23b 100644 --- a/fs/sync/pipe.go +++ b/fs/sync/pipe.go @@ -2,6 +2,7 @@ package sync import ( "context" + "math/bits" "strconv" "strings" "sync" @@ -30,6 +31,9 @@ type pipe struct { } func newPipe(orderBy string, stats func(items int, totalSize int64), maxBacklog int) (*pipe, error) { + if maxBacklog < 0 { + maxBacklog = (1 << (bits.UintSize - 1)) - 1 // largest posititive int + } less, fraction, err := newLess(orderBy) if err != nil { return nil, fserrors.FatalError(err)