Skip to content

Commit

Permalink
tpl/debug: Fix reset of debug timers when running the server
Browse files Browse the repository at this point in the history
Fixes #12621
  • Loading branch information
bep committed Jun 24, 2024
1 parent 6cd0784 commit c880faa
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tpl/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit c880faa

Please sign in to comment.