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

This commit is contained in:
Nick Craig-Wood 2020-05-15 11:23:16 +01:00
parent 7f44735709
commit 147f97d1f7
2 changed files with 7 additions and 0 deletions

View file

@ -745,6 +745,9 @@ time and make `--order-by` work more accurately.
Setting this small will make rclone more synchronous to the listings Setting this small will make rclone more synchronous to the listings
of the remote which may be desirable. of the remote which may be desirable.
Setting this to a negative number will make the backlog as large as
possible.
### --max-delete=N ### ### --max-delete=N ###
This tells rclone not to delete more than N files. If that limit is This tells rclone not to delete more than N files. If that limit is

View file

@ -2,6 +2,7 @@ package sync
import ( import (
"context" "context"
"math/bits"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -30,6 +31,9 @@ type pipe struct {
} }
func newPipe(orderBy string, stats func(items int, totalSize int64), maxBacklog int) (*pipe, error) { 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) less, fraction, err := newLess(orderBy)
if err != nil { if err != nil {
return nil, fserrors.FatalError(err) return nil, fserrors.FatalError(err)