remove app update check interval

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.
This commit is contained in:
Feross Aboukhadijeh
2016-03-21 20:17:16 -07:00
parent f0df9011df
commit 310eebce2a
2 changed files with 3 additions and 14 deletions

View File

@@ -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'),

View File

@@ -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)
})
}