Improve the server assets cache invalidation logic

Fixes #6199
This commit is contained in:
Bjørn Erik Pedersen
2019-08-13 12:35:04 +02:00
parent 6315098104
commit cd575023af
8 changed files with 206 additions and 50 deletions

View File

@@ -917,10 +917,12 @@ func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) erro
logger = helpers.NewDistinctFeedbackLogger()
)
cachePartitions := make([]string, len(events))
var cachePartitions []string
for i, ev := range events {
cachePartitions[i] = resources.ResourceKeyPartition(ev.Name)
for _, ev := range events {
if assetsFilename := s.BaseFs.Assets.MakePathRelative(ev.Name); assetsFilename != "" {
cachePartitions = append(cachePartitions, resources.ResourceKeyPartitions(assetsFilename)...)
}
if s.isContentDirEvent(ev) {
logger.Println("Source changed", ev)