Hotfix on top of v1.4.37. Post-deploy verification caught /api/analytics cold-mount hits of ~62 s and parallel /api/health checks of ~58 s on the live instance — far above the v1.4.37 perf claim of 1.5–3 s.
Root cause
The synchronous ensureUserRollupsFresh(userId) call at the top of each heavy read path (/api/analytics, comprehensive aggregator, summaries slice) folds the trailing 90-day DAY window when the rollup watermark trails the newest measurement. On an account with high-frequency Apple Health step ingest the watermark falls behind every few minutes, so each cache miss synchronously paid the full refresh cost on a Node worker that also serves the rest of the request fan-out — including /api/health, /api/version, and concurrent iOS calls — and the event loop was blocked for the duration of the recompute.
Fix
Three call sites converted to fire-and-forget. The downstream probeRollupCoverage check falls back to live SQL when a type is partial, so correctness is preserved. The only user-observable change is one cache window of staleness on the very first request after a brand-new measurement landed; the next request returns the up-to-date value once the background refresh completes.
Operator notes
- No schema change. No env-var change.
- Coolify auto-deploys main on tag push.