diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-10-28 17:40:07 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-10-28 17:40:07 +0200 |
commit | 3f64b5a3de5f097c4ee1b70505398f75feb391c4 (patch) | |
tree | 270a00912a61dceb57730ff42fa0392cc0805bae /modules | |
parent | 66904097e02fc3e846ec87a9db023df92cf613ba (diff) | |
download | hugo-3f64b5a3de5f097c4ee1b70505398f75feb391c4.tar.gz hugo-3f64b5a3de5f097c4ee1b70505398f75feb391c4.zip |
modules: Adjust the log throttle logic a little
Diffstat (limited to 'modules')
-rw-r--r-- | modules/client.go | 6 |
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{ |