refactor: tighten gateway client test boundary · openclaw/openclaw@025e6ac
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
packages/gateway-client/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -358,6 +358,7 @@ export type GatewayClientOptions = {
|
358 | 358 | */ |
359 | 359 | preauthHandshakeTimeoutMs?: number; |
360 | 360 | tickWatchMinIntervalMs?: number; |
| 361 | +tickWatchTimeoutMs?: number; |
361 | 362 | requestTimeoutMs?: number; |
362 | 363 | token?: string; |
363 | 364 | bootstrapToken?: string; |
@@ -1404,7 +1405,14 @@ export class GatewayClient {
|
1404 | 1405 | return; |
1405 | 1406 | } |
1406 | 1407 | const gap = Date.now() - this.lastTick; |
1407 | | -if (gap > this.tickIntervalMs * 2) { |
| 1408 | +const rawTimeoutMs = this.opts.tickWatchTimeoutMs; |
| 1409 | +// Normal gateways use the server-advertised tick interval. Long-running |
| 1410 | +// harness clients can widen the threshold without mutating internals. |
| 1411 | +const timeoutMs = |
| 1412 | +typeof rawTimeoutMs === "number" && Number.isFinite(rawTimeoutMs) |
| 1413 | + ? Math.max(1, rawTimeoutMs) |
| 1414 | + : this.tickIntervalMs * 2; |
| 1415 | +if (gap > timeoutMs) { |
1408 | 1416 | this.ws?.close(4000, "tick timeout"); |
1409 | 1417 | } |
1410 | 1418 | }, interval); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。