diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-05-03 11:04:57 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-05-04 19:45:43 +0200 |
commit | 503d20954f10507b9b43c6ee1c38001e53cf0b14 (patch) | |
tree | 06e1aeddd995c2b8ff2fb48c0879187b2b819e4b /hugolib/content_map_page.go | |
parent | 68e95327f7be941c44c256d2dac74ea96e731674 (diff) | |
download | hugo-503d20954f10507b9b43c6ee1c38001e53cf0b14.tar.gz hugo-503d20954f10507b9b43c6ee1c38001e53cf0b14.zip |
Make the cache eviction logic for stale entities more robust
Fixes #12458
Diffstat (limited to 'hugolib/content_map_page.go')
-rw-r--r-- | hugolib/content_map_page.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 5a6b49c55..a0bff7472 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -824,10 +824,10 @@ func (s *contentNodeShifter) Insert(old, new contentNodeI) contentNodeI { if !ok { panic(fmt.Sprintf("unknown type %T", new)) } - if newp != old { - resource.MarkStale(old) - } if vv.s.languagei == newp.s.languagei { + if newp != old { + resource.MarkStale(old) + } return new } is := make(contentNodeIs, s.numLanguages) @@ -843,7 +843,6 @@ func (s *contentNodeShifter) Insert(old, new contentNodeI) contentNodeI { if oldp != newp { resource.MarkStale(oldp) } - vv[newp.s.languagei] = new return vv case *resourceSource: @@ -852,6 +851,9 @@ func (s *contentNodeShifter) Insert(old, new contentNodeI) contentNodeI { panic(fmt.Sprintf("unknown type %T", new)) } if vv.LangIndex() == newp.LangIndex() { + if vv != newp { + resource.MarkStale(vv) + } return new } rs := make(resourceSources, s.numLanguages) @@ -1064,7 +1066,7 @@ func (h *HugoSites) resolveAndClearStateForIdentities( ) for _, id := range changes { - if staler, ok := id.(resource.Staler); ok && !staler.IsStale() { + if staler, ok := id.(resource.Staler); ok { var msgDetail string if p, ok := id.(*pageState); ok && p.File() != nil { msgDetail = fmt.Sprintf(" (%s)", p.File().Filename()) |