* 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)
| 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 |
no test coverage detected