fix(moderationService): start health server on port+1000 (follow-up P1)

- moderationService main.go 加 health.NewHandler + Start/Stop, 与其它 9 个 service 一致;
- 启动 health server 监听 21011 (Dubbo 端口 20011 + 1000), /health + /healthz 都注册;
- 补完后 11 个 service 都启了 health server(注: statisticService 用 gin 21009, 不冲突);
- 此前 P1 follow-up 标记的 'Pod never ready' 阻塞解除 (前提: k8s 探针改用 healthPort, 见下个 commit)。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zerosaturation 2026-07-24 15:14:31 +08:00
parent d3b57e3058
commit 812aab2b79

View File

@ -14,6 +14,7 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/imports"
"github.com/topfans/backend/pkg/database"
"github.com/topfans/backend/pkg/health"
"github.com/topfans/backend/pkg/logger"
pb "github.com/topfans/backend/pkg/proto/moderation"
"github.com/topfans/backend/services/moderationService/client"
@ -76,6 +77,12 @@ func main() {
}
db := database.GetDB()
// 启动健康检查 HTTP 服务器(与其它 service 一致:服务端口 + 1000
healthPort := *port + 1000 // e.g., 20011 -> 21011
healthHandler := health.NewHandler("moderation-service", healthPort)
healthHandler.Start()
defer healthHandler.Stop()
// 初始化 Redis
rdb := client.NewRedisClient(*redisHost, *redisPort, *redisPassword, *redisDB)