Skip to main content

sweep_blocking

Function sweep_blocking 

Source
fn sweep_blocking(
    filestore: &FileStore,
    agents: Vec<(String, String)>,
    states: HashMap<String, BlockState>,
    last_published: &HashMap<String, AgentProgress>,
    force_republish: bool,
) -> (HashMap<String, BlockState>, Vec<SweepOutcome>, (Vec<NewEdit>, Vec<NewPr>))
Expand description

The whole file-reading half of a sweep, run OFF the async runtime.

FileStore::stat/read_at are synchronous, mutex-guarded SQLite reads, and this loop runs them for every live agent at a 3s cadence (reagent P2 on PR #2952). Doing that inline would park a Tokio worker thread on disk I/O several times a second — tolerable at activity_watcher’s 20s, much less so here. states is moved in and back out rather than shared behind a lock: only this loop ever touches it, and one owner is simpler than one mutex.