fix(gateway): bound health monitor intervals · openclaw/openclaw@d06e1b2
steipete
·
2026-05-31
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 2 | import type { ChannelId } from "../channels/plugins/types.js"; |
3 | 3 | import type { ChannelAccountSnapshot } from "../channels/plugins/types.js"; |
| 4 | +import { MAX_TIMER_TIMEOUT_MS } from "../shared/number-coercion.js"; |
4 | 5 | import { startChannelHealthMonitor } from "./channel-health-monitor.js"; |
5 | 6 | import type { ChannelManager, ChannelRuntimeSnapshot } from "./server-channels.js"; |
6 | 7 | |
@@ -169,6 +170,16 @@ describe("channel-health-monitor", () => {
|
169 | 170 | expect(removeEventListener).toHaveBeenCalledWith("abort", addEventListener.mock.calls[0]?.[1]); |
170 | 171 | }); |
171 | 172 | |
| 173 | +it("normalizes oversized check intervals before arming timers", () => { |
| 174 | +const setIntervalSpy = vi.spyOn(globalThis, "setInterval"); |
| 175 | +const monitor = startDefaultMonitor(createMockChannelManager(), { |
| 176 | +checkIntervalMs: Number.MAX_SAFE_INTEGER, |
| 177 | +}); |
| 178 | + |
| 179 | +expect(setIntervalSpy).toHaveBeenCalledWith(expect.any(Function), MAX_TIMER_TIMEOUT_MS); |
| 180 | +monitor.stop(); |
| 181 | +}); |
| 182 | + |
172 | 183 | it("does not run before the grace period", async () => { |
173 | 184 | const manager = createMockChannelManager(); |
174 | 185 | const monitor = startDefaultMonitor(manager, { startupGraceMs: 60_000 }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。