mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Handle resource changes when the resources is already evicted from cache
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
This commit is contained in:
@@ -1018,14 +1018,6 @@ func (h *HugoSites) resolveAndClearStateForIdentities(
|
||||
b = cachebuster(s)
|
||||
}
|
||||
|
||||
if b {
|
||||
identity.WalkIdentitiesShallow(v, func(level int, id identity.Identity) bool {
|
||||
// Add them to the change set so we can reset any page that depends on them.
|
||||
changes = append(changes, id)
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -1037,6 +1029,15 @@ func (h *HugoSites) resolveAndClearStateForIdentities(
|
||||
}
|
||||
}
|
||||
|
||||
// Drain the the cache eviction stack.
|
||||
evicted := h.Deps.MemCache.DrainEvictedIdentities()
|
||||
if len(evicted) < 200 {
|
||||
changes = append(changes, evicted...)
|
||||
} else {
|
||||
// Mass eviction, we might as well invalidate everything.
|
||||
changes = []identity.Identity{identity.GenghisKhan}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
seen := make(map[identity.Identity]bool)
|
||||
var n int
|
||||
|
Reference in New Issue
Block a user