From 84fc925d877ee43166a00b245524e29842a1562f Mon Sep 17 00:00:00 2001 From: Janne Savolainen Date: Wed, 15 Jun 2022 09:16:59 +0300 Subject: [PATCH] Make sure all rejections of orphan promise is catched Signed-off-by: Janne Savolainen --- .../periodical-check-for-updates.injectable.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts b/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts index 7315d2a09f..b6b5f7b852 100644 --- a/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts +++ b/src/main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable.ts @@ -5,21 +5,22 @@ import { getInjectable } from "@ogre-tools/injectable"; import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import processCheckingForUpdatesInjectable from "../check-for-updates/process-checking-for-updates.injectable"; +import withOrphanPromiseInjectable from "../../../common/utils/with-orphan-promise/with-orphan-promise.injectable"; const periodicalCheckForUpdatesInjectable = getInjectable({ id: "periodical-check-for-updates", instantiate: (di) => { - const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable); + const withOrphanPromise = di.inject(withOrphanPromiseInjectable); + const processCheckingForUpdates = withOrphanPromise(di.inject(processCheckingForUpdatesInjectable)); return getStartableStoppable("periodical-check-for-updates", () => { const TWO_HOURS = 1000 * 60 * 60 * 2; - // Note: intentional orphan promise to make checking for updates happen in the background processCheckingForUpdates("periodic"); const intervalId = setInterval(() => { - // Note: intentional orphan promise to make checking for updates happen in the background + processCheckingForUpdates("periodic"); }, TWO_HOURS);