diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-09 10:05:19 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-09 14:18:40 +0200 |
commit | 51f08b0b6aae175299b4e73d521343a4386a9cf7 (patch) | |
tree | 6966bc277671a1f62e9363a2a16fa7a2d6ccacd1 /tpl | |
parent | 860c51c314e1f2b06b1424a3b277a2db96fc1f04 (diff) |
Revise the use of htime.Since/htime.Now
We cannot (also, it doesn't add any value) use that when the `clock` is set,
* To measure time (before that global is set)
* To compare file timestamps re cache eviction
Fixes #9868
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/partials/partials.go | 4 | ||||
-rw-r--r-- | tpl/tplimpl/template.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tpl/partials/partials.go b/tpl/partials/partials.go index 9ded32a71..eb4ebfe32 100644 --- a/tpl/partials/partials.go +++ b/tpl/partials/partials.go @@ -25,8 +25,8 @@ import ( "reflect" "strings" "sync" + "time" - "github.com/gohugoio/hugo/common/htime" texttemplate "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate" "github.com/gohugoio/hugo/helpers" @@ -222,7 +222,7 @@ func createKey(name string, variants ...any) (partialCacheKey, error) { var errUnHashable = errors.New("unhashable") func (ns *Namespace) getOrCreate(ctx context.Context, key partialCacheKey, context any) (result any, err error) { - start := htime.Now() + start := time.Now() defer func() { if r := recover(); r != nil { err = r.(error) diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index d352f02e8..c092ff638 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -27,10 +27,10 @@ import ( "sort" "strings" "sync" + "time" "unicode" "unicode/utf8" - "github.com/gohugoio/hugo/common/htime" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/helpers" @@ -235,7 +235,7 @@ func (t *templateExec) ExecuteWithContext(ctx context.Context, templ tpl.Templat defer rlocker.RUnlock() } if t.Metrics != nil { - defer t.Metrics.MeasureSince(templ.Name(), htime.Now()) + defer t.Metrics.MeasureSince(templ.Name(), time.Now()) } if t.templateUsageTracker != nil { |