mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make sure all rejections of orphan promise is catched
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
b7e165cdba
commit
84fc925d87
@ -5,21 +5,22 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable";
|
||||||
import processCheckingForUpdatesInjectable from "../check-for-updates/process-checking-for-updates.injectable";
|
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({
|
const periodicalCheckForUpdatesInjectable = getInjectable({
|
||||||
id: "periodical-check-for-updates",
|
id: "periodical-check-for-updates",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
const withOrphanPromise = di.inject(withOrphanPromiseInjectable);
|
||||||
|
const processCheckingForUpdates = withOrphanPromise(di.inject(processCheckingForUpdatesInjectable));
|
||||||
|
|
||||||
return getStartableStoppable("periodical-check-for-updates", () => {
|
return getStartableStoppable("periodical-check-for-updates", () => {
|
||||||
const TWO_HOURS = 1000 * 60 * 60 * 2;
|
const TWO_HOURS = 1000 * 60 * 60 * 2;
|
||||||
|
|
||||||
// Note: intentional orphan promise to make checking for updates happen in the background
|
|
||||||
processCheckingForUpdates("periodic");
|
processCheckingForUpdates("periodic");
|
||||||
|
|
||||||
const intervalId = setInterval(() => {
|
const intervalId = setInterval(() => {
|
||||||
// Note: intentional orphan promise to make checking for updates happen in the background
|
|
||||||
processCheckingForUpdates("periodic");
|
processCheckingForUpdates("periodic");
|
||||||
}, TWO_HOURS);
|
}, TWO_HOURS);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user