Unverified Commit 39d9d22c authored by Jeffrey Morgan's avatar Jeffrey Morgan Committed by GitHub
Browse files

close server on receiving signal (#4213)

parent af47413d
...@@ -898,7 +898,12 @@ func RunServer(cmd *cobra.Command, _ []string) error { ...@@ -898,7 +898,12 @@ func RunServer(cmd *cobra.Command, _ []string) error {
return err return err
} }
return server.Serve(ln) err = server.Serve(ln)
if errors.Is(err, http.ErrServerClosed) {
return nil
}
return err
} }
func initializeKeypair() error { func initializeKeypair() error {
......
...@@ -1041,6 +1041,7 @@ func Serve(ln net.Listener) error { ...@@ -1041,6 +1041,7 @@ func Serve(ln net.Listener) error {
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM) signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
go func() { go func() {
<-signals <-signals
srvr.Close()
done() done()
sched.unloadAllRunners() sched.unloadAllRunners()
gpu.Cleanup() gpu.Cleanup()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment