From 399a9518b897d4f5536501189efd1a658c3bc97a Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Sat, 15 Jul 2017 09:05:09 -0400 Subject: [PATCH] Optimize check for updates It could cause periodic jank after the first 2 minutes, and then again every hour after that Fix #9996 --- app/updater.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/updater.js b/app/updater.js index bb2577c9ce4..102c957dd32 100644 --- a/app/updater.js +++ b/app/updater.js @@ -131,17 +131,16 @@ var requestVersionInfo = (done, pingOnly) => { if (!platformBaseUrl) throw new Error('platformBaseUrl not set') // Get the daily, week of year and month update checks - var lastCheckYMD = AppStore.getState().toJS().updates['lastCheckYMD'] || null + const state = AppStore.getState() + var lastCheckYMD = state.getIn(['updates', 'lastCheckYMD']) || null debug(`lastCheckYMD = ${lastCheckYMD}`) - - var lastCheckWOY = AppStore.getState().toJS().updates['lastCheckWOY'] || null + var lastCheckWOY = state.getIn(['updates', 'lastCheckWOY']) || null debug(`lastCheckWOY = ${lastCheckWOY}`) - - var lastCheckMonth = AppStore.getState().toJS().updates['lastCheckMonth'] || null + var lastCheckMonth = state.getIn(['updates', 'lastCheckMonth']) || null debug(`lastCheckMonth = ${lastCheckMonth}`) // Has the browser ever asked for an update - var firstCheckMade = AppStore.getState().toJS().updates['firstCheckMade'] || false + var firstCheckMade = state.getIn(['updates', 'firstCheckMade']) || false debug(`firstCheckMade = ${firstCheckMade}`) // Build query string based on the last date an update request was made