Skip to content

Commit

Permalink
Retry loading it if config doesn't exist in auto updater (#2129)
Browse files Browse the repository at this point in the history
* Made it easier

* Return the config

* Missing semicolon added

* Fixed the linting
  • Loading branch information
leo committed Aug 30, 2017
1 parent 26abc6b commit a2d4936
Show file tree
Hide file tree
Showing 3 changed files with 273 additions and 287 deletions.
11 changes: 10 additions & 1 deletion app/auto-updater.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Packages
const {autoUpdater} = require('electron');
const ms = require('ms');
const retry = require('async-retry');

// Utilities
const notify = require('./notify'); // eslint-disable-line no-unused-vars
Expand All @@ -16,7 +17,15 @@ function init() {
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
let canaryUpdates = false;
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"complexity": 0,
"react/prop-types": 0,
"react/jsx-no-bind": 0,
"linebreak-style": 0
"linebreak-style": 0,
"import/no-extraneous-dependencies": 0
},
"ignores": [
"build/**",
Expand Down Expand Up @@ -117,6 +118,7 @@
},
"dependencies": {
"aphrodite-simple": "0.4.1",
"async-retry": "1.1.3",
"color": "0.11.4",
"hterm-umdjs": "1.1.3",
"json-loader": "0.5.4",
Expand Down
Loading

0 comments on commit a2d4936

Please sign in to comment.