diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-06-24 12:49:35 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-06-24 12:49:35 +0200 |
commit | c880faa99836308014e4daf7a111dbace629901c (patch) | |
tree | 8297cea8fca08d2433e9f8e842df2dafcdcf9bf2 /tpl | |
parent | 6cd0784e447f18e009cbbf30de471e486f7cf356 (diff) | |
download | hugo-c880faa99836308014e4daf7a111dbace629901c.tar.gz hugo-c880faa99836308014e4daf7a111dbace629901c.zip |
tpl/debug: Fix reset of debug timers when running the server
Fixes #12621
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/debug/debug.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tpl/debug/debug.go b/tpl/debug/debug.go index 027454b53..ae1acf5eb 100644 --- a/tpl/debug/debug.go +++ b/tpl/debug/debug.go @@ -30,12 +30,9 @@ import ( // New returns a new instance of the debug-namespaced template functions. func New(d *deps.Deps) *Namespace { - var timers map[string][]*timer + ns := &Namespace{} if d.Log.Level() <= logg.LevelInfo { - timers = make(map[string][]*timer) - } - ns := &Namespace{ - timers: timers, + ns.timers = make(map[string][]*timer) } if ns.timers == nil { @@ -55,7 +52,7 @@ func New(d *deps.Deps) *Namespace { var timersSorted []data - for k, v := range timers { + for k, v := range ns.timers { var total time.Duration var median time.Duration sort.Slice(v, func(i, j int) bool { |