Skip to main content

spawn_fast_path

Function spawn_fast_path 

Source
fn spawn_fast_path(
    fs_watch_pool: Arc<FsWatchPool>,
    mstore: Arc<Store>,
    id_store: Arc<Store>,
    broker: Arc<Broker>,
)
Expand description

Maintains a memory_dir -> agent_id map, refreshed every SWEEP_INTERVAL tick (piggybacking on the same cadence as the slow path rather than requiring a separate agent-spawn/teardown hook — a newly-defined agent is picked up within one tick, not instantly, which is an acceptable, honestly-bounded lag for a fast path whose whole purpose is narrowing a gap, not eliminating it). FsWatchPool subscriptions have no Drop-based teardown (see pool.rs — holding or discarding a Subscription value doesn’t affect the underlying watch), so a dir is watched for the life of the process once first seen; we only need to track which dirs we’ve already called subscribe_dir on to avoid redundant re-subscription every tick.