更新es报错降级为警告

This commit is contained in:
Cold
2025-12-20 11:27:10 +08:00
committed by 张斌
parent 2a31e3faac
commit 4b9491cf20

View File

@@ -45,9 +45,11 @@ func Init(ctx context.Context) (err error) {
}
// 测试连接
info, code, err := client.Ping(addresses[0]).Do(ctx)
if err != nil {
glog.Errorf(ctx, "ES 连接测试失败: %v", err)
info, code, testErr := client.Ping(addresses[0]).Do(ctx)
if testErr != nil {
glog.Warningf(ctx, "ES 连接测试失败(月度归档功能不可用): %v", testErr)
client = nil // 清空客户端
err = testErr
return
}
glog.Infof(ctx, "ES 连接成功 - 版本: %s, 状态码: %d", info.Version.Number, code)