summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-28 17:40:07 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-28 17:40:07 +0200
commit3f64b5a3de5f097c4ee1b70505398f75feb391c4 (patch)
tree270a00912a61dceb57730ff42fa0392cc0805bae /modules
parent66904097e02fc3e846ec87a9db023df92cf613ba (diff)
modules: Adjust the log throttle logic a little
Diffstat (limited to 'modules')
-rw-r--r--modules/client.go6
1 files changed, 4 insertions, 2 deletions
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{