mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Revert "modules: Adjust the log throttle logic a little"
This reverts commit 3f64b5a3de
.
This commit is contained in:
parent
3ed28e4bfe
commit
eb5fd3127f
1 changed files with 2 additions and 4 deletions
|
@ -106,18 +106,16 @@ func NewClient(cfg ClientConfig) *Client {
|
||||||
|
|
||||||
var throttleSince time.Time
|
var throttleSince time.Time
|
||||||
throttle := func(f func()) {
|
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() {
|
if throttleSince.IsZero() {
|
||||||
throttleSince = time.Now()
|
throttleSince = time.Now()
|
||||||
|
f()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if time.Since(throttleSince) < 6*time.Second {
|
if time.Since(throttleSince) < 6*time.Second {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f()
|
|
||||||
throttleSince = time.Now()
|
throttleSince = time.Now()
|
||||||
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{
|
return &Client{
|
||||||
|
|
Loading…
Reference in a new issue