fix(monitor): reduce health check result initialization

This commit is contained in:
yusing 2025-05-09 12:14:34 +08:00
parent 0387739b94
commit 99eccd0b95

View file

@ -188,13 +188,15 @@ func (mon *monitor) String() string {
return mon.Name()
}
var resHealthy = &health.HealthCheckResult{
Healthy: true,
}
// MarshalJSON implements health.HealthMonitor.
func (mon *monitor) MarshalJSON() ([]byte, error) {
res := mon.lastResult.Load()
if res == nil {
res = &health.HealthCheckResult{
Healthy: true,
}
res = resHealthy
}
return (&health.JSONRepresentation{