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

Method waitUntilReady

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

1015 * no asynchronous initial-scan window with `fs.watch`.
1016 */
1017 waitUntilReady(timeoutMs = 10000): Promise<void> {
1018 if (this.ready) return Promise.resolve();
1019 return new Promise((resolve, reject) => {
1020 const t = setTimeout(() => {
1021 const idx = this.readyWaiters.indexOf(handler);
1022 if (idx >= 0) this.readyWaiters.splice(idx, 1);
1023 reject(new Error(`FileWatcher.waitUntilReady timed out after ${timeoutMs}ms`));
1024 }, timeoutMs);
1025 const handler = () => { clearTimeout(t); resolve(); };
1026 this.readyWaiters.push(handler);
1027 });
1028 }
1029
1030 /**
1031 * Schedule a normal debounced sync after a source edit.

Calls 2

pushMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected