diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-10-23 19:26:13 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-10-24 13:34:11 +0200 |
commit | cb6e27b32a1d09956027b8e45bae0c18c1593d5c (patch) | |
tree | bd3031431175596ddfad3a79daf69563f723ac6f /tpl | |
parent | 5bbe95f9c5442898cdfb100bff4f1aac52fce5ad (diff) | |
download | hugo-cb6e27b32a1d09956027b8e45bae0c18c1593d5c.tar.gz hugo-cb6e27b32a1d09956027b8e45bae0c18c1593d5c.zip |
hugolib/commands: Fix stuck server error issues
Fixes #11378
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template.go | 1 | ||||
-rw-r--r-- | tpl/tplimpl/template.go | 21 |
2 files changed, 4 insertions, 18 deletions
diff --git a/tpl/template.go b/tpl/template.go index cb8d2b321..18a31e231 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -40,7 +40,6 @@ type TemplateManager interface { TemplateHandler TemplateFuncGetter AddTemplate(name, tpl string) error - MarkReady() error } // TemplateVariants describes the possible variants of a template. diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index 04ccdaad2..fd07db68e 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -168,6 +168,10 @@ func newTemplateHandlers(d *deps.Deps) (*tpl.TemplateHandlers, error) { return nil, err } + if err := h.main.createPrototypes(); err != nil { + return nil, err + } + e := &templateExec{ d: d, executor: exec, @@ -312,28 +316,11 @@ func (t *templateExec) GetFunc(name string) (reflect.Value, bool) { return v, found } -func (t *templateExec) MarkReady() error { - var err error - t.readyInit.Do(func() { - // We only need the clones if base templates are in use. - if len(t.needsBaseof) > 0 { - err = t.main.createPrototypes() - if err != nil { - return - } - } - }) - - return err -} - type templateHandler struct { main *templateNamespace needsBaseof map[string]templateInfo baseof map[string]templateInfo - readyInit sync.Once - // This is the filesystem to load the templates from. All the templates are // stored in the root of this filesystem. layoutsFs afero.Fs |