Skip to main content

start_metadata_writer

Function start_metadata_writer 

Source
pub fn start_metadata_writer(pool: DbPool) -> WorkerMetadataSender
Expand description

Spawns the single background worker-metadata writer and returns a cloneable WorkerMetadataSender. The writer drains events and applies the race-free upserts on pooled connections; it exits cleanly once every sender has dropped. This bounds metadata bookkeeping to one thread regardless of dispatch rate — replacing the unbounded thread-per-event spawn (KNOWN_ISSUES D-1) — while keeping the DB work off the dispatch hot path.