()
| 23 | const CACHE_TTL_MS = 5 * 60_000; |
| 24 | |
| 25 | async function getCachedErrorChannel() { |
| 26 | const now = Date.now(); |
| 27 | if (cachedErrorChannel && now < cacheExpiry) return cachedErrorChannel; |
| 28 | try { |
| 29 | cachedErrorChannel = await getErrorChannel(); |
| 30 | cacheExpiry = now + CACHE_TTL_MS; |
| 31 | } catch { |
| 32 | // DB is down — use whatever we cached last |
| 33 | } |
| 34 | return cachedErrorChannel; |
| 35 | } |
| 36 | |
| 37 | interface ToolErrorContext { |
| 38 | toolName: string; |
no test coverage detected