Skip to main content

spawn_report_populate

Function spawn_report_populate 

Source
pub fn spawn_report_populate(
    pool: DbPool,
    corpus_id: i32,
    service_id: i32,
    severity: &str,
    actor: &str,
) -> Result<Uuid, String>
Expand description

Spawns a background job that (re)computes one (corpus, service, severity) report slice (rollup::populate_scope) off the request path — the heavy aggregation behind a cold report view (minutes for the full-arXiv info slice) runs here instead of pinning a frontend connection and blocking the viewer, who is shown a “report computing” page that refreshes when the slice is ready. Debounced per scope: an already-active populate for the same slice is reused (its uuid returned) rather than spawning a duplicate. Poll GET /api/jobs/<uuid> for status/health.