fix(printer): increase timeout to 15s

This commit is contained in:
Amruth Pillai
2023-11-14 16:06:16 +01:00
parent 36b1930c0d
commit 457aed5f46
6 changed files with 28 additions and 34 deletions

View File

@ -1,11 +1,6 @@
export const delay = (time: number) => new Promise((resolve) => setTimeout(resolve, time));
export const withTimeout = async <T>(promise: Promise<T>, time: number): Promise<T> => {
const timeout = new Promise((_, reject) =>
setTimeout(() => {
reject(new Error(`Operation timed out after ${time} ms.`));
}, time),
);
const timeout = new Promise((_, reject) => setTimeout(() => reject, time));
return Promise.race([promise, timeout]) as T;
};