tpl/partials: Fix partialCached deadlock regression

This is a rollback of  0927cf739f

We cannot do that change until we either completes #9570 or possibly also use the new TryLock in GO 1.18.

Fixes #9588
Opens #4086
This commit is contained in:
Bjørn Erik Pedersen
2022-03-02 10:04:29 +01:00
parent 376704d382
commit 9b8b6d34e2
2 changed files with 58 additions and 20 deletions

View File

@@ -103,6 +103,44 @@ P2
`)
}
// Issue #588
func TestIncludeCachedRecursionShortcode(t *testing.T) {
t.Parallel()
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- content/_index.md --
---
title: "Index"
---
{{< short >}}
-- layouts/index.html --
{{ partials.IncludeCached "p1.html" . }}
-- layouts/partials/p1.html --
{{ .Content }}
{{ partials.IncludeCached "p2.html" . }}
-- layouts/partials/p2.html --
-- layouts/shortcodes/short.html --
SHORT
{{ partials.IncludeCached "p2.html" . }}
P2
`
b := hugolib.NewIntegrationTestBuilder(
hugolib.IntegrationTestConfig{
T: t,
TxtarString: files,
},
).Build()
b.AssertFileContent("public/index.html", `
SHORT
P2
`)
}
func TestIncludeCacheHints(t *testing.T) {
t.Parallel()