mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
e65268f2c2
commit
729593c842
2 changed files with 39 additions and 2 deletions
|
@ -313,3 +313,33 @@ Some content.
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/5375
|
||||
func TestSiteBuildTimeout(t *testing.T) {
|
||||
|
||||
b := newTestSitesBuilder(t)
|
||||
b.WithConfigFile("toml", `
|
||||
timeout = 5
|
||||
`)
|
||||
|
||||
b.WithTemplatesAdded("_default/single.html", `
|
||||
{{ .WordCount }}
|
||||
`, "shortcodes/c.html", `
|
||||
{{ range .Page.Site.RegularPages }}
|
||||
{{ .WordCount }}
|
||||
{{ end }}
|
||||
|
||||
`)
|
||||
|
||||
for i := 1; i < 100; i++ {
|
||||
b.WithContent(fmt.Sprintf("page%d.md", i), `---
|
||||
title: "A page"
|
||||
---
|
||||
|
||||
{{< c >}}`)
|
||||
|
||||
}
|
||||
|
||||
b.CreateSites().Build(BuildCfg{})
|
||||
|
||||
}
|
||||
|
|
|
@ -290,17 +290,24 @@ func (p *Page) initContent() {
|
|||
defer cancel()
|
||||
c := make(chan error, 1)
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
p.contentInitMu.Lock()
|
||||
defer p.contentInitMu.Unlock()
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
|
||||
err = p.prepareForRender()
|
||||
if err != nil {
|
||||
c <- err
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
if len(p.summary) == 0 {
|
||||
if err = p.setAutoSummary(); err != nil {
|
||||
err = p.errorf(err, "failed to set auto summary")
|
||||
|
|
Loading…
Reference in a new issue