mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
Wrap the per-type fan-out in `buildAnalyticsResponse` with a p-limit(4) gate. The empirical v1.4.39 cold-mount trace (`.planning/round-v1439-empirical-trace.md` §B1) showed thick /api/analytics holding ≥8 of the default-10 pg.Pool slots for 6.5 s on a power-user account, starving every other dashboard query. The cap keeps the same total work but holds ≤4 pool slots for this branch at any moment, leaving the remaining slots free for the parallel chart-tile reads. Thick analytics is already 60 s cache-wrapped so the small absolute wall-clock cost on a single cold mount is offset by the chart-tile burst paying ~5 s less of pool-wait time on every mount thereafter.