Skip to main content

spawn_report_refresh

Function spawn_report_refresh 

Source
pub fn spawn_report_refresh(pool: DbPool, actor: &str) -> Result<Uuid, String>
Expand description

Spawns a background job for the manual “Force refresh” action. The global report_summary matview was retired in favour of a per-(corpus, service, severity) cache (report_grain_cache), so this no longer does a multi-minute rebuild: it invalidates the whole cache (a cheap DELETE, never a scan), and each report slice then repopulates lazily, per scope, on its next view. Run off the request path so the caller returns immediately.

Debounced: one global invalidation suffices for every report page, so if a job is already queued or running its uuid is returned instead of spawning another. Poll GET /api/jobs/<uuid> for status/health.