From 6706bc665c7e7e07e58a3f1d12d45ec1141de7cd Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 21 Mar 2016 20:17:16 -0700 Subject: [PATCH] remove app update check interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there’s an update, this would redownload it every 6 hours until the app is restarted. We could fix it, but let’s just simplify this: App updates are checked for on app startup only. --- config.js | 1 - main/auto-updater.js | 16 +++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/config.js b/config.js index 75505688..94146509 100644 --- a/config.js +++ b/config.js @@ -11,7 +11,6 @@ module.exports = { AUTO_UPDATE_URL: 'https://webtorrent.io/app/updates?version=' + APP_VERSION, AUTO_UPDATE_CHECK_STARTUP_DELAY: 60 * 1000 /* 1 minute */, - AUTO_UPDATE_CHECK_INTERVAL: 6 * 60 * 60 * 1000 /* 6 hours */, CONFIG_PATH: applicationConfigPath('WebTorrent'), CONFIG_POSTER_PATH: path.join(applicationConfigPath('WebTorrent'), 'Posters'), diff --git a/main/auto-updater.js b/main/auto-updater.js index f161d9b2..37a400b1 100644 --- a/main/auto-updater.js +++ b/main/auto-updater.js @@ -11,31 +11,21 @@ var autoUpdater = electron.autoUpdater function init () { autoUpdater.on('error', function (err) { - log.error('Auto update error', err.message || err) + log.error('App update error: ' + err.message || err) }) autoUpdater.setFeedURL(config.AUTO_UPDATE_URL) - // TODO: remove - autoUpdater.checkForUpdates() - /* * We always check for updates on app startup. To keep app startup fast, we delay this * first check so it happens when there is less going on. */ setTimeout(() => autoUpdater.checkForUpdates(), config.AUTO_UPDATE_CHECK_STARTUP_DELAY) - /* - * After the first check for updates, we continually check for updates on a regular - * interval. This is to ensure that checks happen even when the app is left open for a - * long time. - */ - setInterval(() => autoUpdater.checkForUpdates(), config.AUTO_UPDATE_CHECK_INTERVAL) - autoUpdater.on('checking-for-update', () => log('Checking for app update')) autoUpdater.on('update-available', () => log('App update available')) autoUpdater.on('update-not-available', () => log('App update not available')) - autoUpdater.on('update-downloaded', function (e) { - log('App update downloaded', e) + autoUpdater.on('update-downloaded', function (e, releaseNotes, releaseName, releaseDate, updateURL) { + log('App update downloaded: ', releaseName, updateURL) }) }