From 3f37a055b140d6a8a83dbd8496c9322731628d8f Mon Sep 17 00:00:00 2001 From: Shreyas Date: Mon, 10 Mar 2025 22:41:57 +0530 Subject: [PATCH] feat(desktop): update check timeout (#4868) `2s` -> `5s` --- packages/hoppscotch-desktop/src/utils/updater.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-desktop/src/utils/updater.ts b/packages/hoppscotch-desktop/src/utils/updater.ts index 529636d4..f7243e36 100644 --- a/packages/hoppscotch-desktop/src/utils/updater.ts +++ b/packages/hoppscotch-desktop/src/utils/updater.ts @@ -12,19 +12,24 @@ export class UpdaterService { }); } - async checkForUpdates(timeout = 2000): Promise { + async checkForUpdates(timeout = 5000): Promise { try { await this.saveUpdateState({ status: UpdateStatus.CHECKING }); - // Create a timeout promise, this is just to make sure we don't keep checking for updates indefinitely - // NOTE: Also `checkUpdate` tends to hang indefinitely in dev mode, but works in build + // This creats a timeout promise that is slightly longer than `check`'s internal timeout, + // this is just to make sure we don't keep checking for updates indefinitely. + // NOTE: `check` tends to hang indefinitely in dev mode, but works in build, + // so this is just in case this ever happens on prod. const timeoutPromise = new Promise((resolve) => { + // Longer local timeout to make sure it only triggers + // if there's an issue with `check`'s built-in timeout. + const bufferTimeout = timeout + 1000; setTimeout(() => { - console.log("Update check timeout reached, proceeding with app load"); + console.log("Update check exceeded buffer timeout, likely hanging in check function"); resolve(null); - }, timeout); + }, bufferTimeout); }); const updateResult = await Promise.race([