mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-22 21:38:10 +00:00
19 lines
639 B
TypeScript
19 lines
639 B
TypeScript
// Timer delay helpers clamp delays to runtime-safe timeout values.
|
|
import { resolveSafeTimeoutDelayMs } from "../../packages/gateway-client/src/timeouts.js";
|
|
|
|
export {
|
|
addSafeTimeoutDelayGraceMs,
|
|
MAX_SAFE_TIMEOUT_DELAY_MS,
|
|
resolveFiniteTimeoutDelayMs,
|
|
resolveSafeTimeoutDelayMs,
|
|
} from "../../packages/gateway-client/src/timeouts.js";
|
|
|
|
/** Wrapper around setTimeout that clamps unsafe or invalid delays before arming the timer. */
|
|
export function setSafeTimeout(
|
|
callback: () => void,
|
|
delayMs: number,
|
|
opts?: { minMs?: number },
|
|
): NodeJS.Timeout {
|
|
return setTimeout(callback, resolveSafeTimeoutDelayMs(delayMs, opts));
|
|
}
|