get rid of pointless interval and timeout on linux
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4c8ff0955d
commit
c4fd139586
1 changed files with 16 additions and 11 deletions
|
@ -24,6 +24,7 @@ module.exports.start = function startAutoUpdate(updateBaseUrl) {
|
||||||
updateBaseUrl = updateBaseUrl + '/';
|
updateBaseUrl = updateBaseUrl + '/';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
let url;
|
||||||
// For reasons best known to Squirrel, the way it checks for updates
|
// For reasons best known to Squirrel, the way it checks for updates
|
||||||
// is completely different between macOS and windows. On macOS, it
|
// is completely different between macOS and windows. On macOS, it
|
||||||
// hits a URL that either gives it a 200 with some json or
|
// hits a URL that either gives it a 200 with some json or
|
||||||
|
@ -36,25 +37,29 @@ module.exports.start = function startAutoUpdate(updateBaseUrl) {
|
||||||
// rely on NSURLConnection setting the User-Agent to what we expect,
|
// rely on NSURLConnection setting the User-Agent to what we expect,
|
||||||
// and also acts as a convenient cache-buster to ensure that when the
|
// and also acts as a convenient cache-buster to ensure that when the
|
||||||
// app updates it always gets a fresh value to avoid update-looping.
|
// app updates it always gets a fresh value to avoid update-looping.
|
||||||
autoUpdater.setFeedURL(`${updateBaseUrl}macos/?localVersion=${encodeURIComponent(app.getVersion())}`);
|
url = `${updateBaseUrl}macos/?localVersion=${encodeURIComponent(app.getVersion())}`;
|
||||||
|
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
autoUpdater.setFeedURL(`${updateBaseUrl}win32/${process.arch}/`);
|
url = `${updateBaseUrl}win32/${process.arch}/`;
|
||||||
} else {
|
} else {
|
||||||
// Squirrel / electron only supports auto-update on these two platforms.
|
// Squirrel / electron only supports auto-update on these two platforms.
|
||||||
// I'm not even going to try to guess which feed style they'd use if they
|
// I'm not even going to try to guess which feed style they'd use if they
|
||||||
// implemented it on Linux, or if it would be different again.
|
// implemented it on Linux, or if it would be different again.
|
||||||
console.log('Auto update not supported on this platform');
|
console.log('Auto update not supported on this platform');
|
||||||
}
|
}
|
||||||
// We check for updates ourselves rather than using 'updater' because we need to
|
|
||||||
// do it in the main process (and we don't really need to check every 10 minutes:
|
if (url) {
|
||||||
// every hour should be just fine for a desktop app)
|
autoUpdater.setFeedURL(url);
|
||||||
// However, we still let the main window listen for the update events.
|
// We check for updates ourselves rather than using 'updater' because we need to
|
||||||
// We also wait a short time before checking for updates the first time because
|
// do it in the main process (and we don't really need to check every 10 minutes:
|
||||||
// of squirrel on windows and it taking a small amount of time to release a
|
// every hour should be just fine for a desktop app)
|
||||||
// lock file.
|
// However, we still let the main window listen for the update events.
|
||||||
setTimeout(pollForUpdates, INITIAL_UPDATE_DELAY_MS);
|
// We also wait a short time before checking for updates the first time because
|
||||||
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
|
// of squirrel on windows and it taking a small amount of time to release a
|
||||||
|
// lock file.
|
||||||
|
setTimeout(pollForUpdates, INITIAL_UPDATE_DELAY_MS);
|
||||||
|
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// will fail if running in debug mode
|
// will fail if running in debug mode
|
||||||
console.log('Couldn\'t enable update checking', err);
|
console.log('Couldn\'t enable update checking', err);
|
||||||
|
|
Loading…
Reference in a new issue