From 38c5b5f0496ab7a713ccc3560c5d363753b77b9b Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Fri, 17 May 2024 14:49:29 +0800 Subject: [PATCH] fix --- library/httpserver/httpserver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/httpserver/httpserver.go b/library/httpserver/httpserver.go index ecf9d0f8..b2538874 100644 --- a/library/httpserver/httpserver.go +++ b/library/httpserver/httpserver.go @@ -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) }