tpl/debug: Add debug.Timer

Closes #11580
This commit is contained in:
Bjørn Erik Pedersen
2023-10-19 10:53:27 +02:00
parent e2dd4cd05f
commit 5160c7efa5
4 changed files with 157 additions and 10 deletions

9
deps/deps.go vendored
View File

@@ -33,7 +33,6 @@ import (
// There will be normally only one instance of deps in play
// at a given time, i.e. one per Site built.
type Deps struct {
// The logger to use.
Log loggers.Logger `json:"-"`
@@ -77,6 +76,9 @@ type Deps struct {
// BuildStartListeners will be notified before a build starts.
BuildStartListeners *Listeners
// BuildEndListeners will be notified after a build finishes.
BuildEndListeners *Listeners
// Resources that gets closed when the build is done or the server shuts down.
BuildClosers *Closers
@@ -97,7 +99,6 @@ func (d Deps) Clone(s page.Site, conf config.AllProvider) (*Deps, error) {
}
return &d, nil
}
func (d *Deps) SetTempl(t *tpl.TemplateHandlers) {
@@ -132,6 +133,10 @@ func (d *Deps) Init() error {
d.BuildStartListeners = &Listeners{}
}
if d.BuildEndListeners == nil {
d.BuildEndListeners = &Listeners{}
}
if d.BuildClosers == nil {
d.BuildClosers = &Closers{}
}