mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
move delay to utils, always retry even if check failed
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
fae4801fda
commit
24f45bf45e
@ -295,7 +295,6 @@
|
||||
"material-design-icons": "^3.0.1",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"mobx-react": "^6.2.2",
|
||||
"moment": "^2.26.0",
|
||||
"node-loader": "^0.6.0",
|
||||
"node-sass": "^4.14.1",
|
||||
"nodemon": "^2.0.4",
|
||||
|
||||
3
src/common/utils/delay.ts
Normal file
3
src/common/utils/delay.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function delay(duration: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, duration));
|
||||
}
|
||||
@ -5,3 +5,4 @@ export * from "./camelCase"
|
||||
export * from "./splitArray"
|
||||
export * from "./getRandId"
|
||||
export * from "./cloneJson"
|
||||
export * from "./delay"
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import { autoUpdater, UpdateInfo } from "electron-updater";
|
||||
import logger from "./logger";
|
||||
import { broadcastIpc, IpcChannel, NotificationChannelAdd, NotificationChannelPrefix } from "../common/ipc";
|
||||
import { IpcChannel, NotificationChannelAdd, NotificationChannelPrefix } from "../common/ipc";
|
||||
import { ipcMain } from "electron";
|
||||
import { isDevelopment } from "../common/vars";
|
||||
import { SemVer } from "semver";
|
||||
import moment from "moment";
|
||||
import { WindowManager } from "./window-manager";
|
||||
|
||||
function delay(duration: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, duration));
|
||||
}
|
||||
import { WindowManager } from "./window-manager"
|
||||
import { delay } from "../common/utils";
|
||||
|
||||
class NotificationBackchannel {
|
||||
private static _id = 0;
|
||||
@ -86,7 +83,7 @@ async function autoUpdateCheck(windowManager: WindowManager): Promise<void> {
|
||||
|
||||
/**
|
||||
* starts the automatic update checking
|
||||
* @param interval milliseconds between interval to check on, defaulkts to 24h
|
||||
* @param interval milliseconds between interval to check on, defaults to 24h
|
||||
*/
|
||||
export function startUpdateChecking(windowManager: WindowManager, interval = 1000 * 60 * 60 * 24): void {
|
||||
if (isDevelopment) {
|
||||
@ -134,11 +131,11 @@ export function startUpdateChecking(windowManager: WindowManager, interval = 100
|
||||
|
||||
async function helper() {
|
||||
while (true) {
|
||||
await autoUpdater.checkForUpdates();
|
||||
await autoUpdater.checkForUpdates()
|
||||
.catch(error => logger.error("[UPDATE CHECKER]: failed with an error", { error: String(error) }));
|
||||
await delay(interval);
|
||||
}
|
||||
}
|
||||
|
||||
helper()
|
||||
.catch(error => logger.error("[UPDATE CHECKER]: failed with an error", { error: String(error) }));
|
||||
helper();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user