pub fn spawn_reindex(pool: DbPool, actor: &str) -> Result<Uuid, String>Expand description
Spawns a background job that rebuilds the high-churn tables’ indexes online with
REINDEX (CONCURRENTLY) — no exclusive lock, so reads/writes continue (DB ongoing-maintenance;
docs/DB_TUNING.md). Runs off the request path (rebuilds are minutes-to-hours at scale) and
reports per-table progress. Debounced: a reindex already queued/running is reused.
REINDEX ... CONCURRENTLY forbids running inside a transaction — the job body uses a fresh
pooled connection in autocommit, so this holds.