MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / waitForRegistrySize

Function waitForRegistrySize

packages/server/test/connections.e2e.test.ts:174–188  ·  view source on GitHub ↗
(
  r: RunningServer,
  target: number,
  timeoutMs: number,
)

Source from the content-addressed store, hash-verified

172}
173
174async function waitForRegistrySize(
175 r: RunningServer,
176 target: number,
177 timeoutMs: number,
178): Promise<void> {
179 const deadline = Date.now() + timeoutMs;
180 while (Date.now() < deadline) {
181 const size = r.services.invokeFunction((a) => a.get(IConnectionRegistry).size());
182 if (size === target) return;
183 await new Promise((res) => {
184 setTimeout(res, 10);
185 });
186 }
187 throw new Error(`registry size ${String(target)} not observed within ${String(timeoutMs)}ms`);
188}
189
190describe('GET /api/v1/connections', () => {
191 it('returns an empty list when no clients are attached', async () => {

Callers 1

Calls 4

nowMethod · 0.65
invokeFunctionMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected