Retry loading it if config doesn't exist in auto updater (#2129)

* Made it easier

* Return the config

* Missing semicolon added

* Fixed the linting
This commit is contained in:
Leo Lamprecht 2017-08-30 18:54:45 +02:00 committed by GitHub
parent 26abc6bd15
commit a2d4936e50
3 changed files with 273 additions and 287 deletions

View file

@ -1,6 +1,7 @@
// Packages // Packages
const {autoUpdater} = require('electron'); const {autoUpdater} = require('electron');
const ms = require('ms'); const ms = require('ms');
const retry = require('async-retry');
// Utilities // Utilities
const notify = require('./notify'); // eslint-disable-line no-unused-vars const notify = require('./notify'); // eslint-disable-line no-unused-vars
@ -16,7 +17,15 @@ function init() {
console.error('Error fetching updates', msg + ' (' + err.stack + ')'); console.error('Error fetching updates', msg + ' (' + err.stack + ')');
}); });
const config = getConfig(); const config = retry(() => {
const content = getConfig();
if (!content) {
throw new Error('No config content loaded');
}
return content;
});
// Default to the "stable" update channel // Default to the "stable" update channel
let canaryUpdates = false; let canaryUpdates = false;

View file

@ -28,7 +28,8 @@
"complexity": 0, "complexity": 0,
"react/prop-types": 0, "react/prop-types": 0,
"react/jsx-no-bind": 0, "react/jsx-no-bind": 0,
"linebreak-style": 0 "linebreak-style": 0,
"import/no-extraneous-dependencies": 0
}, },
"ignores": [ "ignores": [
"build/**", "build/**",
@ -117,6 +118,7 @@
}, },
"dependencies": { "dependencies": {
"aphrodite-simple": "0.4.1", "aphrodite-simple": "0.4.1",
"async-retry": "1.1.3",
"color": "0.11.4", "color": "0.11.4",
"hterm-umdjs": "1.1.3", "hterm-umdjs": "1.1.3",
"json-loader": "0.5.4", "json-loader": "0.5.4",

545
yarn.lock

File diff suppressed because it is too large Load diff