Merge branch 'dev-lwl/consul' into test

This commit is contained in:
lwl0608 2024-05-17 11:46:24 +08:00
commit 989ea4ee60
1 changed files with 2 additions and 4 deletions

View File

@ -21,12 +21,9 @@ const (
)
func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) {
quit := make(chan os.Signal)
go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Fatal("listen: %v", err)
quit <- syscall.SIGTERM
return
}
@ -36,12 +33,13 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin
go func() {
err := registerSD(ip, port)
if err != nil {
quit <- syscall.SIGTERM
logger.Fatal("registerSD: %v", err)
return
}
setServerStatusFD(ServerStatusFDRun)
}()
quit := make(chan os.Signal)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
logger.Info("Shutdown Server ...")