Skip to content

Commit

Permalink
[AMR-98] fix: typeerror updater is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed Oct 22, 2023
1 parent 0a8024e commit d44c805
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/managers/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,23 @@ export function init() {
updater.downloadUpdate();
});

ipcMain.on("update-install", updater.installUpdate);
ipcMain.on("update-install", () => {
let intervalAttempts = 0;

const updateInterval = setInterval(() => {
if (updater) {
updater.installUpdate();
clearInterval(updateInterval);
} else if (intervalAttempts >= 10) {
log.error(
"[IPC][updateInstall]",
"Failed to install update (10 attempts)"
);

clearInterval(updateInterval);
} else intervalAttempts++;
}, 1000);
});

ipcMain.handle("autolaunch-change", () => {
initAutoLaunch();
Expand Down

0 comments on commit d44c805

Please sign in to comment.