From 52ff39a098edf7675d6d58b54e39e79731bb90e6 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Fri, 30 Jan 2026 12:37:40 +0200 Subject: [PATCH] refactor: streamline promise handling in addGameToQueue function for improved error management --- src/main/events/torrenting/add-game-to-queue.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/events/torrenting/add-game-to-queue.ts b/src/main/events/torrenting/add-game-to-queue.ts index f8115533..f57cfaf6 100644 --- a/src/main/events/torrenting/add-game-to-queue.ts +++ b/src/main/events/torrenting/add-game-to-queue.ts @@ -56,17 +56,12 @@ const addGameToQueue = async ( const updatedGame = await gamesSublevel.get(gameKey); - const promises: Promise[] = [ + await Promise.all([ + createGame(updatedGame!).catch(() => {}), HydraApi.post(`/games/${shop}/${objectId}/download`, null, { needsAuth: false, }).catch(() => {}), - ]; - - if (updatedGame) { - promises.push(createGame(updatedGame).catch(() => {})); - } - - await Promise.all(promises); + ]); return { ok: true }; } catch (err: unknown) {