MCPcopy Create free account
hub / github.com/github/copilot-sdk / withTimeout

Function withTimeout

nodejs/test/e2e/multi-client.e2e.test.ts:38–50  ·  view source on GitHub ↗
(promise: Promise<T>, ms: number, label: string)

Source from the content-addressed store, hash-verified

36 });
37
38 async function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T> {
39 let timer: ReturnType<typeof setTimeout> | undefined;
40 try {
41 return await Promise.race([
42 promise,
43 new Promise<T>((_, reject) => {
44 timer = setTimeout(() => reject(new Error(`Timeout: ${label}`)), ms);
45 }),
46 ]);
47 } finally {
48 if (timer) clearTimeout(timer);
49 }
50 }
51
52 function waitForEvent(
53 session: { on: (handler: (event: SessionEvent) => void) => () => void },

Callers 1

waitForEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…