This commit is contained in:
lwl0608 2024-05-17 14:49:29 +08:00
parent e9116d17d4
commit 38c5b5f049
1 changed files with 6 additions and 1 deletions

View File

@ -41,12 +41,17 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin
done := make(chan int)
go func() {
quit := make(chan os.Signal)
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
for {
select {
case <-quit:
logger.Info("Shutdown Server ...")
for i := 0; i < 10; i++ {
logger.Info("__Shutdown sleep %v", i+1)
time.Sleep(time.Second)
}
if err := servicediscovery.DeRegister(ip, port); err != nil {
logger.Fatal("DeRegister fail: %v", err)
}