From 4cc1cc95ca42df805225bde7337277435c778a11 Mon Sep 17 00:00:00 2001 From: 1amKhush Date: Wed, 15 Apr 2026 20:37:03 +0000 Subject: [PATCH] Fix voice call cold-start timeout and preserve custom timeout message (#174) (#203) Co-authored-by: 1amKhush Co-committed-by: 1amKhush --- package.json | 3 ++- src/app/call/voice.ts | 2 +- src/lib/util.ts | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a9237ab9..1097658e 100644 --- a/package.json +++ b/package.json @@ -107,5 +107,6 @@ "overrides": { "sharp": "0.35.0-rc.0" } - } + }, + "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319" } diff --git a/src/app/call/voice.ts b/src/app/call/voice.ts index 95cab6a5..07ab0648 100644 --- a/src/app/call/voice.ts +++ b/src/app/call/voice.ts @@ -277,7 +277,7 @@ export const joinVoiceRoom = async ( try { await Promise.race([ liveKitRoom.connect(server_url, participant_token, {maxRetries: 0}), - whenTimeout(5_000, { + whenTimeout(15_000, { message: "Connection timed out. Please check your network and try again.", }), whenAborted(signal), diff --git a/src/lib/util.ts b/src/lib/util.ts index 59f9fb21..4749ec00 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -46,7 +46,9 @@ export const whenAborted = (signal?: AbortSignal) => { /** Returns a promise that rejects with TimeoutError after ms. Use with Promise.race. */ export const whenTimeout = (ms: number, opts: {message?: string} = {}) => { - return new Promise((_, reject) => setTimeout(() => reject(new TimeoutError()), ms)) + return new Promise((_, reject) => + setTimeout(() => reject(new TimeoutError(opts.message)), ms), + ) } export const buildUrl = (base: string | URL, ...pathname: string[]) => {