From a6469e67a80469e5c779a7ff617759b9bd630a17 Mon Sep 17 00:00:00 2001 From: Aditya kumar singh <143548997+Adityakk9031@users.noreply.github.com> Date: Wed, 20 May 2026 09:05:05 +0530 Subject: [PATCH] Fix public resource health with unknown WireGuard targets --- server/lib/alerts/events/healthCheckEvents.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/lib/alerts/events/healthCheckEvents.ts b/server/lib/alerts/events/healthCheckEvents.ts index 1b9ff40ae..429cf73b0 100644 --- a/server/lib/alerts/events/healthCheckEvents.ts +++ b/server/lib/alerts/events/healthCheckEvents.ts @@ -221,10 +221,18 @@ async function handleResource( ) .where(eq(targets.resourceId, resource.resourceId)); + const monitoredTargets = otherTargets.filter( + (t) => t.hcHealth !== "unknown" + ); + let health = "healthy"; - const allUnknown = otherTargets.every((t) => t.hcHealth === "unknown"); - const allHealthy = otherTargets.every((t) => t.hcHealth === "healthy"); - const allUnhealthy = otherTargets.every((t) => t.hcHealth === "unhealthy"); + const allUnknown = monitoredTargets.length === 0; + const allHealthy = monitoredTargets.every( + (t) => t.hcHealth === "healthy" + ); + const allUnhealthy = monitoredTargets.every( + (t) => t.hcHealth === "unhealthy" + ); if (allUnknown) { logger.debug(