From 9d6e3fdc875a95f4e6c32c939902ef93441e6923 Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 16 Jan 2026 14:09:07 +0800 Subject: [PATCH] fix(health): correct docker fallback url --- internal/health/monitor/monitor.go | 5 +++++ internal/health/monitor/new.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/health/monitor/monitor.go b/internal/health/monitor/monitor.go index 93875115..2e019403 100644 --- a/internal/health/monitor/monitor.go +++ b/internal/health/monitor/monitor.go @@ -26,6 +26,8 @@ type ( config types.HealthCheckConfig url synk.Value[*url.URL] + onUpdateURL func(url *url.URL) + status synk.Value[types.HealthStatus] lastResult synk.Value[types.HealthCheckResult] @@ -151,6 +153,9 @@ func (mon *monitor) UpdateURL(url *url.URL) { return } mon.url.Store(url) + if mon.onUpdateURL != nil { + mon.onUpdateURL(url) + } } // URL implements HealthChecker. diff --git a/internal/health/monitor/new.go b/internal/health/monitor/new.go index dbad4260..285f081b 100644 --- a/internal/health/monitor/new.go +++ b/internal/health/monitor/new.go @@ -97,7 +97,7 @@ func NewDockerHealthMonitor(config types.HealthCheckConfig, client *docker.Share isFirstFailure := true var mon monitor - mon.init(displayURL, config, func(u *url.URL) (result Result, err error) { + mon.init(displayURL, config, func(_ *url.URL) (result Result, err error) { result, err = healthcheck.Docker(mon.Context(), state, config.Timeout) if err != nil { if isFirstFailure { @@ -106,11 +106,11 @@ func NewDockerHealthMonitor(config types.HealthCheckConfig, client *docker.Share logger.Err(err).Msg("docker health check failed, using fallback") } } - fallback.UpdateURL(u) return fallback.CheckHealth() } return result, nil }) + mon.onUpdateURL = fallback.UpdateURL return &mon }