diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-05 14:27:35 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-05 14:27:35 +0100 |
commit | c37bf19c898035de1518c3f2ab4380f08817151f (patch) | |
tree | d9fd6299624e469d84879eaf63f49860ad5718fd /commands | |
parent | 9c6d377872885fb28f4d8534d6765432e6c23ab6 (diff) | |
download | hugo-c37bf19c898035de1518c3f2ab4380f08817151f.tar.gz hugo-c37bf19c898035de1518c3f2ab4380f08817151f.zip |
commands: Revert the recent changes that allowed profiling on server rebuilds
There have been indications that this may freeze the server.
Diffstat (limited to 'commands')
-rw-r--r-- | commands/commandeer.go | 3 | ||||
-rw-r--r-- | commands/hugobuilder.go | 20 | ||||
-rw-r--r-- | commands/server.go | 5 |
3 files changed, 13 insertions, 15 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go index 82d684153..1e5928ff9 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -339,11 +339,10 @@ func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args if r.buildWatch { defer r.timeTrack(time.Now(), "Built") } - close, err := b.build() + err := b.build() if err != nil { return err } - close() return nil }() if err != nil { diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go index 6ae9640b0..f5bc73087 100644 --- a/commands/hugobuilder.go +++ b/commands/hugobuilder.go @@ -361,32 +361,34 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa return watcher, nil } -func (c *hugoBuilder) build() (func(), error) { +func (c *hugoBuilder) build() error { stopProfiling, err := c.initProfiling() if err != nil { - return nil, err + return err } + defer func() { + if stopProfiling != nil { + stopProfiling() + } + }() + if err := c.fullBuild(false); err != nil { - return nil, err + return err } if !c.r.quiet { c.r.Println() h, err := c.hugo() if err != nil { - return nil, err + return err } h.PrintProcessingStats(os.Stdout) c.r.Println() } - return func() { - if stopProfiling != nil { - stopProfiling() - } - }, nil + return nil } func (c *hugoBuilder) buildSites(noBuildLock bool) (err error) { diff --git a/commands/server.go b/commands/server.go index e803d4824..bdf6e905a 100644 --- a/commands/server.go +++ b/commands/server.go @@ -495,19 +495,16 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg } - var close func() err := func() error { defer c.r.timeTrack(time.Now(), "Built") var err error - close, err = c.build() + err = c.build() return err }() if err != nil { return err } - defer close() - return c.serve() } |