This is a follow up to db28695ff5 -- that commit dropped the cache items evicted in the LRU process. This was done as performance optimization for large Hugo sites.
That made much sense, but now there's a slight chance that we miss out on a change when rebuilding.
This commit fixes this by applying the same logic to the evicted items as if they were still in the cache. This should preserve the performance gains in db28695ff5 and close the hole for the possible false negatives.
Two issues:
1. Fixe potential edit-loop in server/watch mode (see below)
2. Drain the cache eviction stack before we start calculating the change set. This should allow more fine grained rebuilds for bigger sites and/or in low memory situations.
The fix in 6c68142cc1 wasn't really fixing the complete problem.
In Hugo we have some steps that takes more time than others, one example being CSS building with TailwindCSS.
The symptom here is that sometimes when you:
1. Edit content or templates that does not trigger a CSS rebuild => Snappy rebuild.
2. Edit stylesheet or add a CSS class to template that triggers a CSS rebuild => relatively slow rebuild (expected)
3. Then back to content editing or template edits that should not trigger a CSS rebuild => relatively slow rebuild (not expected)
This commit fixes this by pulling the dynacache GC step up and merge it with the cache buster step.
Fixes#13316
The main use case for this is to resolve links and resources (e.g. images) relative to the included `Page`.
A typical `include` would similar to this:
```handlebars
{{ with site.GetPage (.Get 0) }}
{{ .RenderShortcodes }}
{{ end }}
```
And when used in a Markdown file:
```markdown
{{% include "/posts/p1" %}}
```
Any render hook triggered while rendering `/posts/p1` will get `/posts/p1` when calling `.PageInner`.
Note that
* This is only relevant for shortcodes included with `{{%` that calls `.RenderShortcodes`.
* `.PageInner` is available in all render hooks that, before this commit, received `.Page`.
* `.PageInner` will fall back to the value of `.Page` if not relevant and will always have a value.
Fixes#12356
The partial rebuilds works by calaulating a baseline from a change set.
For new content, this doesn't work, so to avoid rebuilding everything, we first
try to collect a sample of surrounding identities (e.g. content files in the same section).
This commit fixes a flaw in that logic that in some (many...) cases would return a too small sample set.
Fixes#12054
Also fix a logical flaw in the cache resizer that made it too aggressive. After this I haven't been able to reproduce #11988, but I need to look closer.
Closes#11973
Updates #11988