feat(health-check): introduce health probe gap configuration and enhance health check logic
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:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user