()
| 70 | const rows = new Array<IndexReading>(projects.length); |
| 71 | let cursor = 0; |
| 72 | const worker = async () => { |
| 73 | while (cursor < projects.length) { |
| 74 | if (!enabled.current || document.visibilityState === 'hidden') throw new Error('Index reading paused.'); |
| 75 | const index = cursor++; |
| 76 | const project = projects[index]; |
| 77 | try { |
| 78 | if (!api.projectHealth) throw new Error('Project health is unavailable.'); |
| 79 | rows[index] = { project, health: await api.projectHealth(project.name), error: null }; |
| 80 | } catch (error) { |
| 81 | rows[index] = { project, health: previous.current.get(project.name)?.health ?? null, error: failureText(error) }; |
| 82 | } |
| 83 | } |
| 84 | }; |
| 85 | const work = await Promise.allSettled(Array.from({ length: Math.min(4, projects.length) }, worker)); |
| 86 | const failed = work.find(result => result.status === 'rejected'); |
| 87 | if (failed?.status === 'rejected') throw failed.reason; |
nothing calls this directly
no test coverage detected