Misc remote HTTP/content adapter enhancements

* Recover from server errors
* Improve go adapter rebuilds when adding new content

See #12502
Fixes #12570
This commit is contained in:
Bjørn Erik Pedersen
2024-06-05 09:21:45 +02:00
parent bc05d854b2
commit 2b05a50f8f
4 changed files with 33 additions and 2 deletions

View File

@@ -386,6 +386,21 @@ func (m *pageMap) addPagesFromGoTmplFi(fi hugofs.FileMetaInfo, buildConfig *Buil
pt.AddChange(n.GetIdentity())
} else {
pt.AddChange(u.GetIdentity())
// New content not in use anywhere.
// To make sure that these gets listed in any site.RegularPages ranges or similar
// we could invalidate everything, but first try to collect a sample set
// from the surrounding pages.
var surroundingIDs []identity.Identity
ids := h.pageTrees.collectIdentitiesSurrounding(pi.Base(), 10)
if len(ids) > 0 {
surroundingIDs = append(surroundingIDs, ids...)
} else {
// No surrounding pages found, so invalidate everything.
surroundingIDs = []identity.Identity{identity.GenghisKhan}
}
for _, id := range surroundingIDs {
pt.AddChange(id)
}
}
}