From d491e2b9625df04cedf6d1c6342008a3e1d1d559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=A7=E6=A1=90?= <1058165620@qq.com> Date: Tue, 12 Nov 2024 22:16:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(server):=20=E6=B7=BB=E5=8A=A0=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=E6=A3=80=E6=9F=A5=E6=8E=A5=E5=8F=A3=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=82=E6=95=B0=E6=8E=A5=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 rabbit内部服务器中注册健康检查 HTTP 服务 - 优化 HealthService 的 Check 方法,使用 _ 忽略未使用的参数 - 统一 houyi 和 rabbit 的健康检查接口实现 --- cmd/server/houyi/internal/service/health.go | 2 +- cmd/server/rabbit/internal/server/server.go | 1 + cmd/server/rabbit/internal/service/health.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/server/houyi/internal/service/health.go b/cmd/server/houyi/internal/service/health.go index 813f4f53e..867d34033 100644 --- a/cmd/server/houyi/internal/service/health.go +++ b/cmd/server/houyi/internal/service/health.go @@ -23,7 +23,7 @@ func NewHealthService(heartbeatBiz *biz.HeartbeatBiz) *HealthService { } // Check 检查 -func (s *HealthService) Check(ctx context.Context, req *api.CheckRequest) (*api.CheckReply, error) { +func (s *HealthService) Check(_ context.Context, _ *api.CheckRequest) (*api.CheckReply, error) { return &api.CheckReply{Healthy: true, Version: env.Version()}, nil } diff --git a/cmd/server/rabbit/internal/server/server.go b/cmd/server/rabbit/internal/server/server.go index 0d4ae963f..174046356 100644 --- a/cmd/server/rabbit/internal/server/server.go +++ b/cmd/server/rabbit/internal/server/server.go @@ -72,6 +72,7 @@ func RegisterService( // 注册HTTP服务 pushapi.RegisterConfigHTTPServer(httpSrv, configService) hookapi.RegisterHookHTTPServer(httpSrv, hookService) + api.RegisterHealthHTTPServer(httpSrv, healthService) r := httpSrv.Route("/") r.POST("/v1/hook/send/{route}", hookService.HookSendMsgHTTPHandler()) diff --git a/cmd/server/rabbit/internal/service/health.go b/cmd/server/rabbit/internal/service/health.go index c91575fbe..e4868ebdb 100644 --- a/cmd/server/rabbit/internal/service/health.go +++ b/cmd/server/rabbit/internal/service/health.go @@ -23,7 +23,7 @@ func NewHealthService(heartbeatBiz *biz.HeartbeatBiz) *HealthService { } // Check 检查 -func (s *HealthService) Check(ctx context.Context, req *api.CheckRequest) (*api.CheckReply, error) { +func (s *HealthService) Check(_ context.Context, _ *api.CheckRequest) (*api.CheckReply, error) { return &api.CheckReply{Healthy: true, Version: env.Version()}, nil }