From 7fb015b07dd910785c0a25d7ce3a8eccb9defefd Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 20 Oct 2024 11:50:02 +0800 Subject: [PATCH] refactor graceful shutdown --- cmd/dashboard/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index 07aaac7..7462745 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -93,7 +93,6 @@ func main() { grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc")) httpL := m.Match(cmux.HTTP1Fast()) - // TODO 使用 cmux 在同一端口服务 HTTP 和 gRPC singleton.CleanMonitorHistory() go rpc.ServeRPC(grpcL) serviceSentinelDispatchBus := make(chan model.Monitor) // 用于传递服务监控任务信息的channel @@ -110,7 +109,7 @@ func main() { log.Println("NEZHA>> Graceful::START") singleton.RecordTransferHourlyUsage() log.Println("NEZHA>> Graceful::END") - srv.Shutdown(c) + m.Close() return nil }); err != nil { log.Printf("NEZHA>> ERROR: %v", err)