mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
[优化] 优化对主配置路径的存在性检查以增强健康检查逻辑
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user