Apply editorconfig
This commit is contained in:
parent
ad3191957a
commit
b05e415acf
131 changed files with 16404 additions and 13617 deletions
|
|
@ -1,16 +1,16 @@
|
|||
export async function withTimeout<T>(
|
||||
promise: Promise<T>,
|
||||
timeoutMs: number,
|
||||
operationName: string
|
||||
promise: Promise<T>,
|
||||
timeoutMs: number,
|
||||
operationName: string
|
||||
): Promise<T> {
|
||||
return Promise.race([
|
||||
promise,
|
||||
new Promise<T>((_, reject) =>
|
||||
setTimeout(() => {
|
||||
reject(
|
||||
new Error(`${operationName} timed out after ${timeoutMs}ms`)
|
||||
);
|
||||
}, timeoutMs)
|
||||
)
|
||||
]);
|
||||
return Promise.race([
|
||||
promise,
|
||||
new Promise<T>((_, reject) =>
|
||||
setTimeout(() => {
|
||||
reject(
|
||||
new Error(`${operationName} timed out after ${timeoutMs}ms`)
|
||||
);
|
||||
}, timeoutMs)
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue