{"action":"created","issue":{"url":"https://api.github.com/repos/electron/electron/issues/5057","repository_url":"https://api.github.com/repos/electron/electron","labels_url":"https://api.github.com/repos/electron/electron/issues/5057/labels{/name}","comments_url":"https://api.github.com/repos/electron/electron/issues/5057/comments","events_url":"https://api.github.com/repos/electron/electron/issues/5057/events","html_url":"https://github.com/electron/electron/issues/5057","id":146410345,"number":5057,"title":"auto-updater-win.js downloads updates twice when available.","user":{"login":"djpereira","id":15444756,"avatar_url":"https://avatars.githubusercontent.com/u/15444756?v=3","gravatar_id":"","url":"https://api.github.com/users/djpereira","html_url":"https://github.com/djpereira","followers_url":"https://api.github.com/users/djpereira/followers","following_url":"https://api.github.com/users/djpereira/following{/other_user}","gists_url":"https://api.github.com/users/djpereira/gists{/gist_id}","starred_url":"https://api.github.com/users/djpereira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djpereira/subscriptions","organizations_url":"https://api.github.com/users/djpereira/orgs","repos_url":"https://api.github.com/users/djpereira/repos","events_url":"https://api.github.com/users/djpereira/events{/privacy}","received_events_url":"https://api.github.com/users/djpereira/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/electron/electron/labels/windows","name":"windows","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-06T19:30:04Z","updated_at":"2016-04-07T02:49:46Z","closed_at":null,"body":"* Electron version: 0.37.3\r\n* Operating system: Windows \r\n\r\nWhen you look at the code for auto-updater-win.js, `squirrelUpdate.download` gets called and if succesful then `squirrelUpdate.update` gets called too.\r\n```\r\nAutoUpdater.prototype.checkForUpdates = function () {\r\n  if (!this.updateURL) {\r\n    return this.emitError('Update URL is not set')\r\n  }\r\n  if (!squirrelUpdate.supported()) {\r\n    return this.emitError('Can not find Squirrel')\r\n  }\r\n  this.emit('checking-for-update')\r\n  squirrelUpdate.download(this.updateURL, (error, update) => {\r\n    if (error != null) {\r\n      return this.emitError(error)\r\n    }\r\n    if (update == null) {\r\n      return this.emit('update-not-available')\r\n    }\r\n    this.emit('update-available')\r\n    squirrelUpdate.update(this.updateURL, (error) => {\r\n      var date, releaseNotes, version\r\n      if (error != null) {\r\n        return this.emitError(error)\r\n      }\r\n      releaseNotes = update.releaseNotes\r\n      version = update.version\r\n\r\n      // Following information is not available on Windows, so fake them.\r\n      date = new Date()\r\n      this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {\r\n        this.quitAndInstall()\r\n      })\r\n    })\r\n  })\r\n}\r\n```\r\nThese two calls in turn call Squirrel's `Update.exe  --download` and `Update.exe --update`.\r\n\r\nIf you look at [Squirrel's source code](https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Update/Program.cs), in both cases this will call `UpdateManager.DownloadReleases`, effectively downloading the whole release twice.\r\n\r\nI 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."},"comment":{"url":"https://api.github.com/repos/electron/electron/issues/comments/206668771","html_url":"https://github.com/electron/electron/issues/5057#issuecomment-206668771","issue_url":"https://api.github.com/repos/electron/electron/issues/5057","id":206668771,"user":{"login":"paulcbetts","id":1396,"avatar_url":"https://avatars.githubusercontent.com/u/1396?v=3","gravatar_id":"","url":"https://api.github.com/users/paulcbetts","html_url":"https://github.com/paulcbetts","followers_url":"https://api.github.com/users/paulcbetts/followers","following_url":"https://api.github.com/users/paulcbetts/following{/other_user}","gists_url":"https://api.github.com/users/paulcbetts/gists{/gist_id}","starred_url":"https://api.github.com/users/paulcbetts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulcbetts/subscriptions","organizations_url":"https://api.github.com/users/paulcbetts/orgs","repos_url":"https://api.github.com/users/paulcbetts/repos","events_url":"https://api.github.com/users/paulcbetts/events{/privacy}","received_events_url":"https://api.github.com/users/paulcbetts/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T02:49:46Z","updated_at":"2016-04-07T02:49:46Z","body":"> @paulcbetts is this not the case? Will this cause double downloads?\r\n\r\nWe shouldn't need to double-download, but I can look into it\r\n"}}