MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / warmCachesYielding

Method warmCachesYielding

src/resolution/index.ts:369–383  ·  view source on GitHub ↗

* warmCaches for the async resolution entry points: streams the distinct * name set with periodic yields instead of one synchronous `.all()`. On a * multi-million-node index the DISTINCT scan is a solid multi-second block * (measured up to 28s inside `codegraph sync` on the Linux kernel ind

(onYield: MaybeYield)

Source from the content-addressed store, hash-verified

367 * result, same memory — only the event loop keeps turning.
368 */
369 async warmCachesYielding(onYield: MaybeYield): Promise<void> {
370 if (this.cachesWarmed) return;
371
372 this.knownFiles = new Set(this.queries.getAllFilePaths());
373
374 const names = new Set<string>();
375 let scanned = 0;
376 for (const name of this.queries.iterateNodeNames()) {
377 names.add(name);
378 if ((++scanned & 8191) === 0) await onYield();
379 }
380 this.knownNames = names;
381
382 this.cachesWarmed = true;
383 }
384
385 /**
386 * Clear internal caches

Callers 1

Calls 2

getAllFilePathsMethod · 0.80
iterateNodeNamesMethod · 0.80

Tested by

no test coverage detected