mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix(monitor): reduce health check result initialization
This commit is contained in:
parent
0387739b94
commit
99eccd0b95
1 changed files with 5 additions and 3 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Reference in a new issue