From 3f64b5a3de5f097c4ee1b70505398f75feb391c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 28 Oct 2023 17:40:07 +0200 Subject: modules: Adjust the log throttle logic a little --- modules/client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules') 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{ -- cgit v1.2.3