Skip to content

Commit 056707d

Browse files
mushuiyu886steipete
authored andcommitted
fix(gateway): honor remote status probe timeout
1 parent 25e2017 commit 056707d

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/commands/gateway-status.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,15 @@ describe("gateway-status command", () => {
983983
]);
984984
});
985985

986+
it("passes the full caller timeout through to active configured remote probes", async () => {
987+
const { runtime } = createRuntimeCapture();
988+
probeGateway.mockClear();
989+
990+
await runGatewayStatus(runtime, { timeout: "15000", json: true });
991+
992+
expect(requireProbeCall("wss://remote.example:18789").timeoutMs).toBe(15_000);
993+
});
994+
986995
it("uses configured handshake timeout as the default local probe budget", async () => {
987996
const { runtime } = createRuntimeCapture();
988997
probeGateway.mockClear();

src/commands/gateway-status/helpers.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,30 @@ describe("resolveProbeBudgetMs", () => {
436436
).toBe(2_500);
437437
});
438438

439-
it("keeps non-local probe caps unchanged", () => {
439+
it("lets active remote probes use the full caller budget", () => {
440440
expect(
441441
resolveProbeBudgetMs(15_000, {
442442
kind: "configRemote",
443443
active: true,
444444
url: "wss://gateway.example/ws",
445445
}),
446-
).toBe(1500);
446+
).toBe(15_000);
447447
expect(
448448
resolveProbeBudgetMs(15_000, {
449449
kind: "explicit",
450450
active: true,
451451
url: "wss://gateway.example/ws",
452452
}),
453+
).toBe(15_000);
454+
});
455+
456+
it("keeps inactive remote and SSH tunnel probes on the short cap", () => {
457+
expect(
458+
resolveProbeBudgetMs(15_000, {
459+
kind: "configRemote",
460+
active: false,
461+
url: "wss://gateway.example/ws",
462+
}),
453463
).toBe(1500);
454464
expect(
455465
resolveProbeBudgetMs(15_000, {

src/commands/gateway-status/helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ export function resolveProbeBudgetMs(
150150
if (target.kind === "sshTunnel") {
151151
return Math.min(2000, overallMs);
152152
}
153-
if (!isLoopbackProbeTarget(target)) {
154-
return Math.min(1500, overallMs);
153+
if (target.active) {
154+
return overallMs;
155155
}
156-
if (target.kind === "localLoopback" && !target.active) {
156+
if (target.kind === "localLoopback") {
157157
return Math.min(800, overallMs);
158158
}
159-
// Active/discovered loopback probes and explicit loopback URLs should honor
160-
// the caller budget because healthy local detail RPCs can legitimately take
161-
// longer than the legacy short caps.
159+
if (!isLoopbackProbeTarget(target)) {
160+
return Math.min(1500, overallMs);
161+
}
162162
return overallMs;
163163
}
164164

0 commit comments

Comments
 (0)