Merge branch 'dev-lwl/consul' into test
This commit is contained in:
commit
989ea4ee60
|
@ -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 ...")
|
||||
|
|
Loading…
Reference in New Issue