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

accounting: fix --bwlimit when up or down is off - fixes #5019

Nick Craig-Wood2aebeb60618f
diff --git a/fs/accounting/token_bucket.go b/fs/accounting/token_bucket.go
index 377d9af44..cafd55e14 100644
--- a/fs/accounting/token_bucket.go
+++ b/fs/accounting/token_bucket.go
@@ -68,7 +68,8 @@ func newTokenBucket(bandwidth fs.BwPair) (tbs buckets) {
bandwidthAccounting = bandwidth.Rx
}
}
- if bandwidthAccounting > 0 {
+ // Limit core bandwidth to max of Rx and Tx if both are limited
+ if bandwidth.Tx > 0 && bandwidth.Rx > 0 {
tbs[TokenBucketSlotAccounting] = rate.NewLimiter(rate.Limit(bandwidthAccounting), maxBurstSize)
}
for _, tb := range tbs {