commands: Avoid too many watch file handles causing the server to fail to start

Fixes #8904
This commit is contained in:
Shiming Zhang 2021-08-19 17:04:09 +08:00 committed by GitHub
parent 24589c0814
commit 3f38c785b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -261,6 +261,11 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
s.RegisterMediaTypes()
}
err = c.serve(sc)
if err != nil {
return err
}
// Watch runs its own server as part of the routine
if sc.serverWatch {
@ -283,7 +288,7 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
}
return c.serve(sc)
return nil
}
func getRootWatchDirsStr(baseDir string, watchDirs []string) string {