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

Method waitUntilReady

src/sync/watcher.ts:775–786  ·  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

773 * no asynchronous initial-scan window with `fs.watch`.
774 */
775 waitUntilReady(timeoutMs = 10000): Promise<void> {
776 if (this.ready) return Promise.resolve();
777 return new Promise((resolve, reject) => {
778 const t = setTimeout(() => {
779 const idx = this.readyWaiters.indexOf(handler);
780 if (idx >= 0) this.readyWaiters.splice(idx, 1);
781 reject(new Error(`FileWatcher.waitUntilReady timed out after ${timeoutMs}ms`));
782 }, timeoutMs);
783 const handler = () => { clearTimeout(t); resolve(); };
784 this.readyWaiters.push(handler);
785 });
786 }
787
788 /**
789 * 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