From a700622f065347b8eceed2bb09bfa168c9511b05 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 11 Oct 2024 11:16:58 +0100 Subject: [PATCH] GracefulStop first --- internal/beater/server.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/beater/server.go b/internal/beater/server.go index 35efba8f483..973269cc8c7 100644 --- a/internal/beater/server.go +++ b/internal/beater/server.go @@ -222,12 +222,10 @@ func (s server) run(ctx context.Context) error { }) g.Go(func() error { <-ctx.Done() + s.grpcServer.GracefulStop() stopctx, cancel := context.WithTimeout(context.Background(), s.cfg.ShutdownTimeout) defer cancel() s.httpServer.stop(stopctx) - // FIXME: will httpServer.stop terminate the grpc connections, making grpcServer.GracefulStop a no-op? - // Will it be better to grpcServer.GracefulStop first as the gmux panic is fixed, so that GOAWAY is sent? - s.grpcServer.GracefulStop() return nil }) if err := g.Wait(); err != http.ErrServerClosed {