mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Fix /static performance regression from Hugo 0.103.0
In `v0.103.0` we added support for `resources.PostProcess` for all file types, not just HTML. We had benchmarks that said we were fine in that department, but those did not consider the static file syncing. This fixes that by: * Making sure that the /static syncer always gets its own file system without any checks for the post process token. * For dynamic files (e.g. rendered HTML files) we add an additional check to make sure that we skip binary files (e.g. images) Fixes #10328
This commit is contained in:
@@ -32,10 +32,9 @@ func newPagesProcessor(h *HugoSites, sp *source.SourceSpec) *pagesProcessor {
|
||||
procs := make(map[string]pagesCollectorProcessorProvider)
|
||||
for _, s := range h.Sites {
|
||||
procs[s.Lang()] = &sitePagesProcessor{
|
||||
m: s.pageMap,
|
||||
errorSender: s.h,
|
||||
itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
|
||||
renderStaticToDisk: h.Cfg.GetBool("renderStaticToDisk"),
|
||||
m: s.pageMap,
|
||||
errorSender: s.h,
|
||||
itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
|
||||
}
|
||||
}
|
||||
return &pagesProcessor{
|
||||
@@ -118,8 +117,6 @@ type sitePagesProcessor struct {
|
||||
ctx context.Context
|
||||
itemChan chan any
|
||||
itemGroup *errgroup.Group
|
||||
|
||||
renderStaticToDisk bool
|
||||
}
|
||||
|
||||
func (p *sitePagesProcessor) Process(item any) error {
|
||||
@@ -164,10 +161,7 @@ func (p *sitePagesProcessor) copyFile(fim hugofs.FileMetaInfo) error {
|
||||
|
||||
defer f.Close()
|
||||
|
||||
fs := s.PublishFs
|
||||
if p.renderStaticToDisk {
|
||||
fs = s.PublishFsStatic
|
||||
}
|
||||
fs := s.PublishFsStatic
|
||||
|
||||
return s.publish(&s.PathSpec.ProcessingStats.Files, target, f, fs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user