Misc resource fixes/improvements

* Add --pprof flag to server to enable profile debugging.
* Don't cache the resource content, it seem to eat memory on bigger sites.
* Keep --printMemoryUsag running in server

Fixes #11974
This commit is contained in:
Bjørn Erik Pedersen 2024-02-02 16:00:48 +01:00
parent d0788b96ae
commit 2873324898
7 changed files with 58 additions and 65 deletions

View file

@ -361,34 +361,32 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
return watcher, nil
}
func (c *hugoBuilder) build() error {
func (c *hugoBuilder) build() (func(), error) {
stopProfiling, err := c.initProfiling()
if err != nil {
return err
return nil, err
}
defer func() {
if stopProfiling != nil {
stopProfiling()
}
}()
if err := c.fullBuild(false); err != nil {
return err
return nil, err
}
if !c.r.quiet {
c.r.Println()
h, err := c.hugo()
if err != nil {
return err
return nil, err
}
h.PrintProcessingStats(os.Stdout)
c.r.Println()
}
return nil
return func() {
if stopProfiling != nil {
stopProfiling()
}
}, nil
}
func (c *hugoBuilder) buildSites(noBuildLock bool) (err error) {