fix: prevent panicking on misconfigurations

This commit is contained in:
yusing
2025-09-07 11:15:35 +08:00
parent 41ce784a7f
commit d588664bfa
4 changed files with 26 additions and 16 deletions

View File

@@ -72,6 +72,9 @@ func NewMonitor(r types.Route) types.HealthMonCheck {
func newMonitor(u *url.URL, config *types.HealthCheckConfig, healthCheckFunc HealthCheckFunc) *monitor {
if config.Retries == 0 {
if config.Interval == 0 {
config.Interval = common.HealthCheckIntervalDefault
}
config.Retries = int64(common.HealthCheckDownNotifyDelayDefault / config.Interval)
}
mon := &monitor{