(envKey: string, fallback: number)
| 15 | }; |
| 16 | |
| 17 | function parseTimeoutEnv(envKey: string, fallback: number): number { |
| 18 | const raw = getEnvVariable(envKey); |
| 19 | if (!raw) return fallback; |
| 20 | const parsed = Number(raw); |
| 21 | if (!Number.isFinite(parsed) || parsed < 0) return fallback; |
| 22 | return parsed; |
| 23 | } |
| 24 | |
| 25 | function defaultTimeoutForScope(scope: 'user' | 'org' | 'admin'): number { |
| 26 | if (scope === 'admin') return parseTimeoutEnv('USAGE_QUERY_TIMEOUT_ADMIN_MS', 20_000); |
no test coverage detected