mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Improved metrics for updating application (#5607)
This commit is contained in:
1 parent
7b0521f3b2
commit
5c049ecca0
15 files changed
+373
-32
No files matched your search
+6
-5
@@ -5,22 +5,23 @@
|
||||
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();
|
||||
processCheckingForUpdates("periodic");
|
||||
|
||||
const intervalId = setInterval(() => {
|
||||
// Note: intentional orphan promise to make checking for updates happen in the background
|
||||
processCheckingForUpdates();
|
||||
|
||||
processCheckingForUpdates("periodic");
|
||||
}, TWO_HOURS);
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in new issue
Block a user