From: Bjørn Erik Pedersen Date: Sat, 28 Oct 2023 15:40:07 +0000 (+0200) Subject: modules: Adjust the log throttle logic a little X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3f64b5a3de5f097c4ee1b70505398f75feb391c4;p=brevno-suite%2Fhugo modules: Adjust the log throttle logic a little --- diff --git a/modules/client.go b/modules/client.go index b3dad498b..9a0415632 100644 --- a/modules/client.go +++ b/modules/client.go @@ -106,16 +106,18 @@ func NewClient(cfg ClientConfig) *Client { var throttleSince time.Time throttle := func(f func()) { + // Skip the first call. + // This is used for "download" etc. and we want to avoid + // logging anything if it is fast. if throttleSince.IsZero() { throttleSince = time.Now() - f() return } if time.Since(throttleSince) < 6*time.Second { return } - throttleSince = time.Now() f() + throttleSince = time.Now() } return &Client{