Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Optimize check for updates #9999

Merged
merged 1 commit into from
Jul 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions app/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update this to use the default value format? ex:
var lastCheckYMD = state.getIn(['updates', 'lastCheckYMD'], null)

might as well make the variables const too instead of var 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, addressed here: 05781e4

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged it all the way up to 0.17.x but obviously no respin for that, just merged it up for the sake of easier merges if anything else changes.

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
Expand Down