mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tpl/debug: Fix reset of debug timers when running the server
Fixes #12621
This commit is contained in:
parent
6cd0784e44
commit
c880faa998
1 changed files with 3 additions and 6 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue