mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 06:14:23 +00:00
perf: speed up gateway missing-tick e2e watchdog
This commit is contained in:
@@ -70,6 +70,7 @@ describe("GatewayClient", () => {
|
||||
const client = new GatewayClient({
|
||||
url: `ws://127.0.0.1:${port}`,
|
||||
connectDelayMs: 0,
|
||||
tickWatchMinIntervalMs: 5,
|
||||
onClose: (code, reason) => resolve({ code, reason }),
|
||||
});
|
||||
client.start();
|
||||
|
||||
@@ -41,6 +41,7 @@ type Pending = {
|
||||
export type GatewayClientOptions = {
|
||||
url?: string; // ws://127.0.0.1:18789
|
||||
connectDelayMs?: number;
|
||||
tickWatchMinIntervalMs?: number;
|
||||
token?: string;
|
||||
password?: string;
|
||||
instanceId?: string;
|
||||
@@ -376,7 +377,12 @@ export class GatewayClient {
|
||||
if (this.tickTimer) {
|
||||
clearInterval(this.tickTimer);
|
||||
}
|
||||
const interval = Math.max(this.tickIntervalMs, 1000);
|
||||
const rawMinInterval = this.opts.tickWatchMinIntervalMs;
|
||||
const minInterval =
|
||||
typeof rawMinInterval === "number" && Number.isFinite(rawMinInterval)
|
||||
? Math.max(1, Math.min(30_000, rawMinInterval))
|
||||
: 1000;
|
||||
const interval = Math.max(this.tickIntervalMs, minInterval);
|
||||
this.tickTimer = setInterval(() => {
|
||||
if (this.closed) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user