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

Function withTimeout

packages/kaos/test/internal.test.ts:16–24  ·  view source on GitHub ↗
(promise: Promise<T>, timeoutMs: number)

Source from the content-addressed store, hash-verified

14}
15
16function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T> {
17 return Promise.race([
18 promise,
19 (async () => {
20 await delay(timeoutMs);
21 throw new Error(`timed out after ${timeoutMs}ms`);
22 })(),
23 ]);
24}
25
26describe('BufferedReadable', () => {
27 it('preserves source backpressure until the consumer starts reading', () => {

Callers 1

internal.test.tsFile · 0.70

Calls 1

delayFunction · 0.85

Tested by

no test coverage detected