Investigate deadlock (#178)
This commit is contained in:
parent
564d4a6c37
commit
7a13cb57ce
7 changed files with 85 additions and 17 deletions
16
frontend/test-client/src/utils/with-timeout.ts
Normal file
16
frontend/test-client/src/utils/with-timeout.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export async function withTimeout<T>(
|
||||
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)
|
||||
)
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue