Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

sync: allow --max-backlog to be -ve meaning as large as possible

Nick Craig-Wood147f97d1f78a
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)