( raw: string | undefined, fallback: number = DEFAULT_WATCHDOG_TIMEOUT_MS )
| 73 | |
| 74 | /** Parse the timeout env, falling back to the default for missing/invalid values. */ |
| 75 | export function parseWatchdogTimeoutMs( |
| 76 | raw: string | undefined, |
| 77 | fallback: number = DEFAULT_WATCHDOG_TIMEOUT_MS |
| 78 | ): number { |
| 79 | if (raw === undefined) return fallback; |
| 80 | const n = Number(raw); |
| 81 | return Number.isFinite(n) && n > 0 ? n : fallback; |
| 82 | } |
| 83 | |
| 84 | /** Derive a heartbeat cadence that emits several beats inside the timeout window. */ |
| 85 | export function deriveCheckIntervalMs(timeoutMs: number): number { |
no outgoing calls
no test coverage detected