]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Revert "modules: Adjust the log throttle logic a little"
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 29 Oct 2023 09:57:25 +0000 (10:57 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 29 Oct 2023 09:57:25 +0000 (10:57 +0100)
This reverts commit 3f64b5a3de5f097c4ee1b70505398f75feb391c4.

modules/client.go

index 9a04156320009665b5b8f1b368bb6b5c02624f20..b3dad498b97c1f4abeb4d09a4314f12d42c7e417 100644 (file)
@@ -106,18 +106,16 @@ 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
                }
-               f()
                throttleSince = time.Now()
+               f()
        }
 
        return &Client{