(fetchImpl: typeof fetch, input: string)
| 34 | } |
| 35 | |
| 36 | async function fetchWithTimeout(fetchImpl: typeof fetch, input: string): Promise<Response> { |
| 37 | const controller = new AbortController(); |
| 38 | const timeout = setTimeout(() => { |
| 39 | controller.abort(); |
| 40 | }, CDN_FETCH_TIMEOUT_MS); |
| 41 | try { |
| 42 | return await fetchImpl(input, { signal: controller.signal }); |
| 43 | } finally { |
| 44 | clearTimeout(timeout); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Fetch the latest published Kimi Code version from the CDN. |
no test coverage detected