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:
@@ -11,7 +11,6 @@ module.exports = {
|
|||||||
|
|
||||||
AUTO_UPDATE_URL: 'https://webtorrent.io/app/updates?version=' + APP_VERSION,
|
AUTO_UPDATE_URL: 'https://webtorrent.io/app/updates?version=' + APP_VERSION,
|
||||||
AUTO_UPDATE_CHECK_STARTUP_DELAY: 60 * 1000 /* 1 minute */,
|
AUTO_UPDATE_CHECK_STARTUP_DELAY: 60 * 1000 /* 1 minute */,
|
||||||
AUTO_UPDATE_CHECK_INTERVAL: 6 * 60 * 60 * 1000 /* 6 hours */,
|
|
||||||
|
|
||||||
CONFIG_PATH: applicationConfigPath('WebTorrent'),
|
CONFIG_PATH: applicationConfigPath('WebTorrent'),
|
||||||
CONFIG_POSTER_PATH: path.join(applicationConfigPath('WebTorrent'), 'Posters'),
|
CONFIG_POSTER_PATH: path.join(applicationConfigPath('WebTorrent'), 'Posters'),
|
||||||
|
|||||||
@@ -11,31 +11,21 @@ var autoUpdater = electron.autoUpdater
|
|||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
autoUpdater.on('error', function (err) {
|
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)
|
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
|
* 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.
|
* first check so it happens when there is less going on.
|
||||||
*/
|
*/
|
||||||
setTimeout(() => autoUpdater.checkForUpdates(), config.AUTO_UPDATE_CHECK_STARTUP_DELAY)
|
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('checking-for-update', () => log('Checking for app update'))
|
||||||
autoUpdater.on('update-available', () => log('App update available'))
|
autoUpdater.on('update-available', () => log('App update available'))
|
||||||
autoUpdater.on('update-not-available', () => log('App update not available'))
|
autoUpdater.on('update-not-available', () => log('App update not available'))
|
||||||
autoUpdater.on('update-downloaded', function (e) {
|
autoUpdater.on('update-downloaded', function (e, releaseNotes, releaseName, releaseDate, updateURL) {
|
||||||
log('App update downloaded', e)
|
log('App update downloaded: ', releaseName, updateURL)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user