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

Function tick

__tests__/mcp-daemon.test.ts:128–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 return new Promise((resolve, reject) => {
127 const started = Date.now();
128 const tick = () => {
129 let v: T | undefined | null | false;
130 try { v = predicate(); } catch (e) { return reject(e); }
131 if (v) return resolve(v as T);
132 if (Date.now() - started > timeoutMs) {
133 // Name the wait: an async stack loses the await site, so an unlabeled
134 // timeout can't tell WHICH step flaked (the #662 test's recurring
135 // timeout was undiagnosable for exactly this reason).
136 return reject(new Error(`Timed out after ${timeoutMs}ms${label ? ` waiting for: ${label}` : ''}`));
137 }
138 setTimeout(tick, pollMs);
139 };
140 tick();
141 });
142}

Callers 1

waitForFunction · 0.70

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected