From 99eccd0b957a85bfd4b1137851e6dc19b8ea4ffc Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 9 May 2025 12:14:34 +0800 Subject: [PATCH] fix(monitor): reduce health check result initialization --- internal/watcher/health/monitor/monitor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/watcher/health/monitor/monitor.go b/internal/watcher/health/monitor/monitor.go index 20bc8ed..0d26940 100644 --- a/internal/watcher/health/monitor/monitor.go +++ b/internal/watcher/health/monitor/monitor.go @@ -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{