From 301e1ad98223a01a230cd73fa9b84a06dbbd556e Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 16 Feb 2021 17:53:44 +0000 Subject: [PATCH] fs: fix crash when --low-level-retries=0 - fixes #5024 --- fs/fs.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index 0e4e73b58..154e6b6ef 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -1449,11 +1449,16 @@ type logCalculator struct { // NewPacer creates a Pacer for the given Fs and Calculator. func NewPacer(ctx context.Context, c pacer.Calculator) *Pacer { + ci := GetConfig(ctx) + retries := ci.LowLevelRetries + if retries <= 0 { + retries = 1 + } p := &Pacer{ Pacer: pacer.New( pacer.InvokerOption(pacerInvoker), - pacer.MaxConnectionsOption(GetConfig(ctx).Checkers+GetConfig(ctx).Transfers), - pacer.RetriesOption(GetConfig(ctx).LowLevelRetries), + pacer.MaxConnectionsOption(ci.Checkers+ci.Transfers), + pacer.RetriesOption(retries), pacer.CalculatorOption(c), ), }