mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-19 06:59:50 +02:00
fix(healthcheck): fix fileserver health check by removing zero port check
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user