mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 23:54:13 +08:00
fix(updater): Check less frequently, stop when update ready to install
This commit is contained in:
parent
01a3fa3876
commit
0ad7a2f716
1 changed files with 6 additions and 3 deletions
|
@ -7,7 +7,7 @@ fs = require 'fs'
|
||||||
|
|
||||||
IdleState = 'idle'
|
IdleState = 'idle'
|
||||||
CheckingState = 'checking'
|
CheckingState = 'checking'
|
||||||
DownladingState = 'downloading'
|
DownloadingState = 'downloading'
|
||||||
UpdateAvailableState = 'update-available'
|
UpdateAvailableState = 'update-available'
|
||||||
NoUpdateAvailableState = 'no-update-available'
|
NoUpdateAvailableState = 'no-update-available'
|
||||||
UnsupportedState = 'unsupported'
|
UnsupportedState = 'unsupported'
|
||||||
|
@ -61,7 +61,7 @@ class AutoUpdateManager
|
||||||
@setState(NoUpdateAvailableState)
|
@setState(NoUpdateAvailableState)
|
||||||
|
|
||||||
autoUpdater.on 'update-available', =>
|
autoUpdater.on 'update-available', =>
|
||||||
@setState(DownladingState)
|
@setState(DownloadingState)
|
||||||
|
|
||||||
autoUpdater.on 'update-downloaded', (event, @releaseNotes, @releaseVersion) =>
|
autoUpdater.on 'update-downloaded', (event, @releaseNotes, @releaseVersion) =>
|
||||||
@setState(UpdateAvailableState)
|
@setState(UpdateAvailableState)
|
||||||
|
@ -69,8 +69,11 @@ class AutoUpdateManager
|
||||||
|
|
||||||
@check(hidePopups: true)
|
@check(hidePopups: true)
|
||||||
setInterval =>
|
setInterval =>
|
||||||
|
if @state in [UpdateAvailableState, UnsupportedState]
|
||||||
|
console.log "Skipping update check... update ready to install, or updater unavailable."
|
||||||
|
return
|
||||||
@check(hidePopups: true)
|
@check(hidePopups: true)
|
||||||
, (1000 * 60 * 5)
|
, (1000 * 60 * 30)
|
||||||
|
|
||||||
switch process.platform
|
switch process.platform
|
||||||
when 'win32'
|
when 'win32'
|
||||||
|
|
Loading…
Reference in a new issue