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
+23 -1
View File
@@ -17,7 +17,7 @@ function startTcpServer(): Promise<{ server: Server; port: number }> {
}
describe("health-check URL helpers", () => {
it("buildHttpProbeUrl uses FQDN in URL (IP pinned via DNS interceptor)", () => {
it("buildHttpProbeUrl uses FQDN in URL (IP pinned via connector)", () => {
expect(
healthCheckService.buildHttpProbeUrl("gt.rkns.top", 443, "/", true),
).toBe("https://gt.rkns.top/");
@@ -125,6 +125,28 @@ describe("health-check probeTarget", () => {
await new Promise<void>((resolve) => httpServer.close(() => resolve()));
}
});
it("physicalProbeKey collapses group+binding on same IP for tcp", async () => {
const { physicalProbeKey } = await import("../src/services/health-check-service.js");
const group: HealthCheckTarget = {
scope: "group",
ref_id: 1,
ip: "93.115.203.183",
hostname: "gt.rkns.top",
type: "tcp",
port: 443,
path: null,
expected_status: null,
timeout_ms: 3000,
};
const binding: HealthCheckTarget = {
...group,
scope: "binding",
ref_id: 2,
hostname: "rutg.rkns.top",
};
expect(physicalProbeKey(group)).toBe(physicalProbeKey(binding));
});
});
describe("health-check state derivation via runAllChecks", () => {