(url)
| 94 | const FETCH_TIMEOUT_MS = 3000; |
| 95 | |
| 96 | async function currentFetchPattern(url) { |
| 97 | const controller = new AbortController(); |
| 98 | const abortTimeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS); |
| 99 | const fetchPromise = fetch(url, { |
| 100 | signal: controller.signal, |
| 101 | headers: { 'Cache-Control': 'no-cache' }, |
| 102 | }); |
| 103 | const hardTimeout = new Promise((_, reject) => |
| 104 | setTimeout(() => reject(new Error('Feature flags fetch timed out')), FETCH_TIMEOUT_MS) |
| 105 | ); |
| 106 | try { |
| 107 | const response = await Promise.race([fetchPromise, hardTimeout]); |
| 108 | clearTimeout(abortTimeout); |
| 109 | return response; |
| 110 | } catch (err) { |
| 111 | clearTimeout(abortTimeout); |
| 112 | throw err; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // (fixedFetchPattern removed — currentFetchPattern already uses Promise.race) |
| 117 |
no outgoing calls
no test coverage detected