Skip to content

Commit

Permalink
commands: Delay server builds after the watcher is set up
Browse files Browse the repository at this point in the history
See #11264
  • Loading branch information
bep committed Jul 19, 2023
1 parent 7ae62f4 commit 5bd22ba
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions commands/server.go
Expand Up @@ -470,14 +470,6 @@ func (c *serverCommand) Name() string {
}

func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
err := func() error {
defer c.r.timeTrack(time.Now(), "Built")
err := c.build()
return err
}()
if err != nil {
return err
}

// Watch runs its own server as part of the routine
if c.serverWatch {
Expand All @@ -501,6 +493,15 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg

}

err := func() error {
defer c.r.timeTrack(time.Now(), "Built")
err := c.build()
return err
}()
if err != nil {
return err
}

return c.serve()
}

Expand Down

0 comments on commit 5bd22ba

Please sign in to comment.