Skip to content

Commit

Permalink
feat(server): 添加健康检查接口并优化参数接收
Browse files Browse the repository at this point in the history
- 在 rabbit内部服务器中注册健康检查 HTTP 服务
- 优化 HealthService 的 Check 方法,使用 _ 忽略未使用的参数
- 统一 houyi 和 rabbit 的健康检查接口实现
  • Loading branch information
aide-cloud committed Nov 12, 2024
1 parent 12aac16 commit d491e2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/server/houyi/internal/service/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions cmd/server/rabbit/internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion cmd/server/rabbit/internal/service/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit d491e2b

Please sign in to comment.