-
Couldn't load subscription status.
- Fork 16.6k
Closed
Description
- Electron version: 0.37.3
- Operating system: Windows
When you look at the code for auto-updater-win.js, squirrelUpdate.download gets called and if succesful then squirrelUpdate.update gets called too.
AutoUpdater.prototype.checkForUpdates = function () {
if (!this.updateURL) {
return this.emitError('Update URL is not set')
}
if (!squirrelUpdate.supported()) {
return this.emitError('Can not find Squirrel')
}
this.emit('checking-for-update')
squirrelUpdate.download(this.updateURL, (error, update) => {
if (error != null) {
return this.emitError(error)
}
if (update == null) {
return this.emit('update-not-available')
}
this.emit('update-available')
squirrelUpdate.update(this.updateURL, (error) => {
var date, releaseNotes, version
if (error != null) {
return this.emitError(error)
}
releaseNotes = update.releaseNotes
version = update.version
// Following information is not available on Windows, so fake them.
date = new Date()
this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {
this.quitAndInstall()
})
})
})
}
These two calls in turn call Squirrel's Update.exe --download and Update.exe --update.
If you look at Squirrel's source code, in both cases this will call UpdateManager.DownloadReleases, effectively downloading the whole release twice.
I may be wrong, but I think it could possibly be more efficient to just call Update.exe --update and that's it. Please let me know if I'm missing something.