fix(healthcheck): fix fileserver health check by removing zero port check

This commit is contained in:
yusing
2025-12-22 12:04:09 +08:00
parent a6e86ea420
commit eb3aa21e37

View File

@@ -33,8 +33,6 @@ type (
checkHealth HealthCheckFunc checkHealth HealthCheckFunc
startTime time.Time startTime time.Time
isZeroPort bool
notifyFunc notif.NotifyFunc notifyFunc notif.NotifyFunc
numConsecFailures atomic.Int64 numConsecFailures atomic.Int64
downNotificationSent atomic.Bool downNotificationSent atomic.Bool
@@ -91,13 +89,6 @@ func newMonitor(u *url.URL, cfg types.HealthCheckConfig, healthCheckFunc HealthC
mon.url.Store(u) mon.url.Store(u)
mon.status.Store(types.StatusHealthy) mon.status.Store(types.StatusHealthy)
mon.lastResult.Store(types.HealthCheckResult{Healthy: true, Detail: "started"}) mon.lastResult.Store(types.HealthCheckResult{Healthy: true, Detail: "started"})
port := u.Port()
mon.isZeroPort = port == "" || port == "0"
if mon.isZeroPort {
mon.status.Store(types.StatusUnknown)
mon.lastResult.Store(types.HealthCheckResult{Healthy: false, Detail: "no port detected"})
}
return mon return mon
} }
@@ -119,10 +110,6 @@ func (mon *monitor) Start(parent task.Parent) gperr.Error {
return ErrNegativeInterval return ErrNegativeInterval
} }
if mon.isZeroPort {
return nil
}
mon.service = parent.Name() mon.service = parent.Name()
mon.task = parent.Subtask("health_monitor", true) mon.task = parent.Subtask("health_monitor", true)