diff --git a/desktop/flow-typed/npm/electron_v22.0.0.js b/desktop/flow-typed/npm/electron_v22.0.0.js --- a/desktop/flow-typed/npm/electron_v22.0.0.js +++ b/desktop/flow-typed/npm/electron_v22.0.0.js @@ -184,6 +184,7 @@ } declare type AutoUpdaterEvents = { + 'error': Error => void, 'checking-for-update': () => void, 'update-available': () => void, 'update-not-available': () => void, diff --git a/desktop/src/auto-update.js b/desktop/src/auto-update.js --- a/desktop/src/auto-update.js +++ b/desktop/src/auto-update.js @@ -11,8 +11,14 @@ // Check for new updates every 10 minutes const updateIntervalMs = 10 * 60_000; + let currentTimeout = null; const scheduleCheckForUpdates = () => { - setTimeout(() => autoUpdater.checkForUpdates(), updateIntervalMs); + if (!currentTimeout) { + currentTimeout = setTimeout(() => { + currentTimeout = null; + autoUpdater.checkForUpdates(); + }, updateIntervalMs); + } }; scheduleCheckForUpdates(); @@ -24,5 +30,10 @@ scheduleCheckForUpdates(); }); + autoUpdater.on('error', error => { + console.error(error); + scheduleCheckForUpdates(); + }); + ipcMain.on('update-to-new-version', () => autoUpdater.quitAndInstall()); }