diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-09-26 17:34:20 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-09-26 19:02:25 +0200 |
commit | 29ccb3606967a4e14ebee383decb38fae6c447dc (patch) | |
tree | 987dd3c25328fe01dafebd77aebd66f039681a99 /hugolib | |
parent | d8aba18e05895723a6e42ea19be1cfbbed5bf98c (diff) |
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
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/filesystems/basefs.go | 2 | ||||
-rw-r--r-- | hugolib/pages_process.go | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/hugolib/filesystems/basefs.go b/hugolib/filesystems/basefs.go index a380857cd..e0fed6f3e 100644 --- a/hugolib/filesystems/basefs.go +++ b/hugolib/filesystems/basefs.go @@ -67,7 +67,7 @@ type BaseFs struct { // This usually maps to /my-project/public. PublishFs afero.Fs - // The filesystem used for renderStaticToDisk. + // The filesystem used for static files. PublishFsStatic afero.Fs // A read-only filesystem starting from the project workDir. diff --git a/hugolib/pages_process.go b/hugolib/pages_process.go index 04ac0218a..196a566f0 100644 --- a/hugolib/pages_process.go +++ b/hugolib/pages_process.go @@ -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) } |