MCPcopy
hub / github.com/colbymchenry/codegraph / waitUntilReady

Method waitUntilReady

src/sync/watcher.ts:702–713  ·  view source on GitHub ↗

* Resolves once the watch set has been installed (or immediately if it * already has). Useful for tests that need a deterministic boundary before * asserting on `pendingFiles`. * * Production callers don't need this: `pendingFiles` is read continuously, * the staleness banner is alway

(timeoutMs = 10000)

Source from the content-addressed store, hash-verified

700 * no asynchronous initial-scan window with `fs.watch`.
701 */
702 waitUntilReady(timeoutMs = 10000): Promise<void> {
703 if (this.ready) return Promise.resolve();
704 return new Promise((resolve, reject) => {
705 const t = setTimeout(() => {
706 const idx = this.readyWaiters.indexOf(handler);
707 if (idx >= 0) this.readyWaiters.splice(idx, 1);
708 reject(new Error(`FileWatcher.waitUntilReady timed out after ${timeoutMs}ms`));
709 }, timeoutMs);
710 const handler = () => { clearTimeout(t); resolve(); };
711 this.readyWaiters.push(handler);
712 });
713 }
714
715 /**
716 * Schedule a normal debounced sync after a source edit.

Callers 2

waitUntilWatcherReadyMethod · 0.80
watcher.test.tsFile · 0.80

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected