Files
orca/src/shared/orchestration-ask-timeout.ts
T
Jinjing 76b2a3b44d fix(cli): bound orchestration ask timeouts (#10689)
* fix(cli): bound orchestration ask timeouts

* fix(cli): harden remote timeout boundaries
2026-07-26 12:50:05 -07:00

15 lines
611 B
TypeScript

export const ORCHESTRATION_ASK_DEFAULT_TIMEOUT_MS = 600_000
export const ORCHESTRATION_ASK_MAX_TIMEOUT_MS = 1_800_000
export const ORCHESTRATION_ASK_CLIENT_GRACE_MS = 5_000
export function clampOrchestrationAskTimeoutMs(timeoutMs: number | undefined): number {
if (timeoutMs === undefined) {
return ORCHESTRATION_ASK_DEFAULT_TIMEOUT_MS
}
return Math.min(Math.max(0, timeoutMs), ORCHESTRATION_ASK_MAX_TIMEOUT_MS)
}
export function resolveOrchestrationAskClientTimeoutMs(timeoutMs: number | undefined): number {
return clampOrchestrationAskTimeoutMs(timeoutMs) + ORCHESTRATION_ASK_CLIENT_GRACE_MS
}