This commit is contained in:
lwl0608 2024-05-17 11:38:43 +08:00
parent 0598f99bd3
commit d76bf6a811
1 changed files with 1 additions and 1 deletions

View File

@ -22,7 +22,6 @@ const (
func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) { func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) {
quit := make(chan os.Signal) quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
go func() { go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
@ -43,6 +42,7 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin
setServerStatusFD(ServerStatusFDRun) setServerStatusFD(ServerStatusFDRun)
}() }()
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit <-quit
logger.Info("Shutdown Server ...") logger.Info("Shutdown Server ...")