mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 12:03:32 +00:00
23 lines
645 B
TypeScript
23 lines
645 B
TypeScript
// Qa Lab plugin module implements timer timeouts behavior.
|
|
import {
|
|
addTimerTimeoutGraceMs,
|
|
clampPositiveTimerTimeoutMs,
|
|
MAX_TIMER_TIMEOUT_MS,
|
|
resolveTimerTimeoutMs,
|
|
} from "openclaw/plugin-sdk/number-runtime";
|
|
|
|
export function resolveQaGatewayTimeoutWithGraceMs(
|
|
timeoutMs: unknown,
|
|
graceMs: unknown = 5_000,
|
|
): number | undefined {
|
|
const timeout = clampPositiveTimerTimeoutMs(timeoutMs);
|
|
if (timeout === undefined) {
|
|
return undefined;
|
|
}
|
|
if (timeout >= MAX_TIMER_TIMEOUT_MS) {
|
|
return MAX_TIMER_TIMEOUT_MS;
|
|
}
|
|
const grace = resolveTimerTimeoutMs(graceMs, 0, 0);
|
|
return addTimerTimeoutGraceMs(timeout, grace);
|
|
}
|