fixed healthcheck failed to disable and nil dereference

This commit is contained in:
yusing
2024-10-19 00:13:55 +08:00
parent 53557e38b6
commit b296fb2965
11 changed files with 60 additions and 20 deletions

View File

@@ -64,5 +64,5 @@ func UseIdleWatcher(entry Entry) bool {
func UseHealthCheck(entry Entry) bool {
hc := entry.HealthCheckConfig()
return hc != nil && !hc.Disabled
return hc != nil && !hc.Disable
}

View File

@@ -126,15 +126,15 @@ func (e *RawEntry) FillMissingFields() {
e.HealthCheck = new(health.HealthCheckConfig)
}
if e.HealthCheck.Disabled {
if e.HealthCheck.Interval == 0 {
e.HealthCheck.Interval = common.HealthCheckIntervalDefault
}
if e.HealthCheck.Timeout == 0 {
e.HealthCheck.Timeout = common.HealthCheckTimeoutDefault
}
if e.HealthCheck.Disable {
e.HealthCheck = nil
} else {
if e.HealthCheck.Interval == 0 {
e.HealthCheck.Interval = common.HealthCheckIntervalDefault
}
if e.HealthCheck.Timeout == 0 {
e.HealthCheck.Timeout = common.HealthCheckTimeoutDefault
}
}
if cont.IdleTimeout != "" {