Skip to main content

FindFilesInFlight

Function FindFilesInFlight 

Source
fn FindFilesInFlight() -> &'static Mutex<HashMap<FindFilesCacheKey, Arc<Notify>>>
Expand description

Single-flight registry: keys with a walk currently in progress share the same Notify so concurrent callers awaiting the same (folders, include, exclude, cap, flags) don’t each kick off their own filesystem walk.

Why: log audit (20260501T053137) showed 1023 findFiles calls during one extension-boot session, with the cache hit rate at ~67% (687 hits, 333 misses). The 333 misses fired BEFORE the first walker for any given key populated the cache, so each one independently re-walked the same tree. With the single-flight guard the leader walks once, every concurrent follower awaits, then reads the freshly-populated cache.