[优化] 优化对主配置路径的存在性检查以增强健康检查逻辑

This commit is contained in:
ryan
2026-05-28 23:29:01 +08:00
parent 6e0b6df314
commit f8509eed26
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -268,6 +268,9 @@ func (r *Runner) refreshOpenrestyHealth(ctx context.Context) {
return
}
if err := r.RuntimeManager.CheckHealth(ctx); err != nil {
if strings.Contains(err.Error(), "openresty config not exists") {
return
}
r.recordOpenrestyUnhealthy(err, true)
return
}
@@ -260,6 +260,11 @@ func (m *Manager) CheckHealth(ctx context.Context) error {
if m.Executor == nil {
return errors.New("executor 未配置")
}
if m.MainConfigPath != "" {
if _, err := os.Stat(m.MainConfigPath); os.IsNotExist(err) {
return errors.New("openresty config not exists: waiting for initial sync")
}
}
return m.Executor.CheckHealth(ctx)
}