MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / timeout

Function timeout

shared/src/utility.ts:156–163  ·  view source on GitHub ↗
(f: () => Promise<T>, ms: number)

Source from the content-addressed store, hash-verified

154 throw Error(`Failed after ${count} tries`)
155}
156async function timeout<T>(f: () => Promise<T>, ms: number) {
157 return await Promise.race([
158 f(),
159 sleep(ms).then(() => {
160 throw Error(undefined, { cause: timeoutSymbol })
161 }),
162 ])
163}
164export async function retryWithTimeout<T>(
165 f: () => Promise<T>,
166 count: number,

Callers 1

retryWithTimeoutFunction · 0.85

Calls 2

sleepFunction · 0.85
ErrorInterface · 0.85

Tested by

no test coverage detected