tpl/debug: Fix reset of debug timers when running the server

Fixes #12621
This commit is contained in:
Bjørn Erik Pedersen 2024-06-24 12:49:35 +02:00
parent 6cd0784e44
commit c880faa998
No known key found for this signature in database

View file

@ -30,12 +30,9 @@ import (
// New returns a new instance of the debug-namespaced template functions. // New returns a new instance of the debug-namespaced template functions.
func New(d *deps.Deps) *Namespace { func New(d *deps.Deps) *Namespace {
var timers map[string][]*timer ns := &Namespace{}
if d.Log.Level() <= logg.LevelInfo { if d.Log.Level() <= logg.LevelInfo {
timers = make(map[string][]*timer) ns.timers = make(map[string][]*timer)
}
ns := &Namespace{
timers: timers,
} }
if ns.timers == nil { if ns.timers == nil {
@ -55,7 +52,7 @@ func New(d *deps.Deps) *Namespace {
var timersSorted []data var timersSorted []data
for k, v := range timers { for k, v := range ns.timers {
var total time.Duration var total time.Duration
var median time.Duration var median time.Duration
sort.Slice(v, func(i, j int) bool { sort.Slice(v, func(i, j int) bool {