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

Function until

__tests__/proxy-shutdown.test.ts:21–27  ·  view source on GitHub ↗
(check: () => boolean, what: string, timeout = 10_000)

Source from the content-addressed store, hash-verified

19const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
20
21async function until(check: () => boolean, what: string, timeout = 10_000): Promise<void> {
22 const deadline = Date.now() + timeout;
23 while (!check()) {
24 if (Date.now() > deadline) throw new Error(`Timed out waiting for ${what}`);
25 await delay(25);
26 }
27}
28
29const line = (msg: object): string => JSON.stringify({ jsonrpc: '2.0', ...msg }) + '\n';
30const INITIALIZE = line({ id: 1, method: 'initialize', params: {} });

Callers 2

startProxyFunction · 0.70

Calls 2

checkFunction · 0.70
delayFunction · 0.70

Tested by

no test coverage detected