Stu Mason
Stu Mason

Activity

Pull Request Opened

PR #34 opened: fix: handle unpopulated materialized view gracefully

Problem

After PR #33 changed the view to WITH NO DATA, two things break:

  1. Scheduled refresh fails every 10 minREFRESH MATERIALIZED VIEW CONCURRENTLY requires the view to be populated first. Every run throws SQLSTATE[0A000]: CONCURRENTLY cannot be used when the materialized view is not populated.

  2. Homepage 500sGetVelocity::getCrossPlatform() queries the unpopulated view and crashes. The dashboard is completely down.

Fix

  • RefreshCommand: Check pg_matviews.ispopulated — if false, use regular (non-concurrent) refresh for initial population. Subsequent refreshes use CONCURRENTLY as before.
  • GetVelocity: Wrap the cross-platform query in try/catch. If the view is broken/empty, return [] so the dashboard loads without that panel.

Impact

Dashboard will load immediately after deploy. Cross-platform data appears once the first scheduled refresh completes (~10 min).

+25
additions
-7
deletions
2
files changed