hugolib: Fix deadlock when content building times out

Fixes #5375
This commit is contained in:
Bjørn Erik Pedersen
2018-10-30 11:15:15 +01:00
parent e65268f2c2
commit 729593c842
2 changed files with 39 additions and 2 deletions

View File

@@ -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{})
}