From bc09ca0f44c43384f3802a2a809f0b574d4a98d9 Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Wed, 25 Dec 2024 15:51:12 +0800 Subject: [PATCH] fix: config --- internal/msggateway/ws_server.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/msggateway/ws_server.go b/internal/msggateway/ws_server.go index f679bdd712..51021ab630 100644 --- a/internal/msggateway/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -190,9 +190,8 @@ func (ws *WsServer) Run(done chan error) error { netErr = errs.WrapMsg(err, "ws start err", server.Addr) } }() + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) shutDown := func() error { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - defer cancel() sErr := server.Shutdown(ctx) if sErr != nil { return errs.WrapMsg(sErr, "shutdown err") @@ -200,8 +199,8 @@ func (ws *WsServer) Run(done chan error) error { close(shutdownDone) return nil } - log.ZError(context.Background(), "NJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ", nil) etcd.RegisterShutDown(shutDown) + defer cancel() var err error select { case err = <-done: