feat(health-check): introduce health probe gap configuration and enhance health check logic
Build and Push CFDM Docker Image / build-and-push (push) Successful in 2m0s
Build and Push CFDM Docker Image / create-release (push) Skipped
Build and Push CFDM Docker Image / update-wiki (push) Successful in 6s

Added `healthProbeGapMs` configuration to control the minimum pause between probes to different physical targets. Updated health check service to utilize this configuration, ensuring efficient probing without overwhelming the targets. Enhanced the `runAllChecks` function to group probes by physical IP and implement the new gap logic. Updated related tests to validate the new functionality.
This commit is contained in:
Denozordec
2026-07-20 03:57:37 +07:00
parent a58d91ff5e
commit 9783974949
8 changed files with 270 additions and 66 deletions
+5 -1
View File
@@ -14,6 +14,8 @@ export interface AppConfig {
healthDegradedFailures: number;
healthDownFailures: number;
healthLatencyWarnMs: number;
/** Min pause between probes to different physical targets (same IP is probed once). */
healthProbeGapMs: number;
logLevel: string;
/** Portal SSO — when true, require portal JWT with apps includes cfdm */
authRequired: boolean;
@@ -46,12 +48,14 @@ export function loadConfig(): AppConfig {
? resolve(process.env.STATIC_DIR)
: null,
certCheckCron: process.env.CERT_CHECK_CRON ?? "0 0 */6 * * *",
healthCheckCron: process.env.HEALTH_CHECK_CRON ?? "*/30 * * * * *",
// Default: every 2 minutes (was every 30s — hammered origins / anti-bot).
healthCheckCron: process.env.HEALTH_CHECK_CRON ?? "0 */2 * * * *",
healthDegradedFailures:
Number(process.env.HEALTH_DEGRADED_FAILURES ?? "1") || 1,
healthDownFailures: Number(process.env.HEALTH_DOWN_FAILURES ?? "2") || 2,
healthLatencyWarnMs:
Number(process.env.HEALTH_LATENCY_WARN_MS ?? "1000") || 1000,
healthProbeGapMs: Number(process.env.HEALTH_PROBE_GAP_MS ?? "2000") || 2000,
logLevel: process.env.LOG_LEVEL ?? "info",
authRequired: boolEnv(process.env.AUTH_REQUIRED, false),
authIssuer: