mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-25 14:26:39 +00:00
Set hcHealth to 'unknown' when health check is disabled in updateTarget
Co-authored-by: oschwartz10612 <4999704+oschwartz10612@users.noreply.github.com>
This commit is contained in:
@@ -208,6 +208,12 @@ export async function updateTarget(
|
|||||||
hcHeaders = JSON.stringify(parsedBody.data.hcHeaders);
|
hcHeaders = JSON.stringify(parsedBody.data.hcHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When health check is disabled, reset hcHealth to "unknown"
|
||||||
|
// to prevent previously unhealthy targets from being excluded
|
||||||
|
const hcHealthValue = (parsedBody.data.hcEnabled === false || parsedBody.data.hcEnabled === null)
|
||||||
|
? "unknown"
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const [updatedHc] = await db
|
const [updatedHc] = await db
|
||||||
.update(targetHealthCheck)
|
.update(targetHealthCheck)
|
||||||
.set({
|
.set({
|
||||||
@@ -223,7 +229,8 @@ export async function updateTarget(
|
|||||||
hcHeaders: hcHeaders,
|
hcHeaders: hcHeaders,
|
||||||
hcFollowRedirects: parsedBody.data.hcFollowRedirects,
|
hcFollowRedirects: parsedBody.data.hcFollowRedirects,
|
||||||
hcMethod: parsedBody.data.hcMethod,
|
hcMethod: parsedBody.data.hcMethod,
|
||||||
hcStatus: parsedBody.data.hcStatus
|
hcStatus: parsedBody.data.hcStatus,
|
||||||
|
...(hcHealthValue !== undefined && { hcHealth: hcHealthValue })
|
||||||
})
|
})
|
||||||
.where(eq(targetHealthCheck.targetId, targetId))
|
.where(eq(targetHealthCheck.targetId, targetId))
|
||||||
.returning();
|
.returning();
|
||||||
|
|||||||
Reference in New Issue
Block a user