Repository navigation
fix(desktop): keep checking for updates after one is offered - #298
Merged
Merged
Conversation
check() returned early while an update was available or ready, so a nightly published after the offer stayed unseen until the next launch. Users installed the older nightly and then updated a second time.
…load Since updates kept polling while an offer or a download stood, a click could land while the hourly check was mid-flight. Clicking Restart and then losing the network made electron-updater emit "error" from that check; the install-failure listener saw the installing status, showed the "could not be installed" dialog and queued a relaunch while quitAndInstall still ran. Clicking Download during the same silent check was coalesced into it: nothing was published and nothing was downloaded. restart() now bumps the generation like setChannel and dispose, so the check's late result is discarded, and waits for the check to settle before quitAndInstall. The error listener treats an error as an install failure only when nothing of ours is running. download() waits for a running check and then decides again from the status it left behind. The restarting flag is gone: "installing" is read from the status, and stillApplies is the generation alone. publish() skips a status object that already stands, which is reconcile's contract for "no change", and carries the channel so a disabled build still broadcasts a channel switch. The unreachable disabled guard in readFeed is replaced by narrowing once at construction, and the download-failure status is one constant. The fake updater emits "error" before any rejected check or download, as AppUpdater does. That gap is what hid the first bug from the suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When a nightly was published while Voice already offered an earlier one, Voice installed the earlier nightly. Fifteen seconds after relaunch it offered the newer one, so the user restarted twice.
check()returned early while the status wasavailableorready, so the startup check, the poll, the tray item, and Settings never saw the newer release. #154 added that rule to keep a background poll from closing the release card.Now every check runs. While an offer is on screen, a check publishes only when the result changes the offer, so the card stays open. T3 Code fixed the same bug the same way in pingdotgg/t3code#6269.
Scope
reconcile()inapps/desktop/src/main/updates.tstakes the status the user sees and a check outcome (offer,none, orerror) and returns the next status.availableoffer.readydownload and starts to download at once, because the user already chose to download. The status leavesreadybefore electron-updater deletes the staged file.readydownload survives a failed check and an empty check.download()reads the feed again before it downloads, because electron-updater downloads whatever its last successful check stored. If the read fails or the feed no longer offers the update, nothing downloads.restart()starts, a late check result or download progress publishes nothing.restart()waits for a check still in flight beforequitAndInstall, andonErrorreports an install failure only when no check or download runs. Without that, a failed hourly check during Restart showed an install-failure dialog while the install went ahead.download()waits for a background check in flight, then reads the status again. Before, a click during a check did nothing.generationalone marks stale results.restart()anddispose()increase it, the same waysetChannel()does, which removes therestartingflag.Tradeoffs
T3 Code sends a superseded download back to a Download button. This change downloads the newer release at once, so the user still restarts only once.
Blast Radius
The change touches update checks in packaged builds on both channels. Development and test-mode builds have updates disabled.
restart()now waits for a check still in flight beforequitAndInstall. A check takes about a second, and a hung check delays the restart at most until its request times out.Verification
updates.test.tsmodels electron-updater 6.8.9. A check compares the feed with the installed version, anddownloadUpdatestages the release from the last check that found one. The regression test failed onmainwithexpected [] to deeply equal [ { kind: 'downloading', … } ](1 failed, 21 passed). It passes now (38 tests in the file).checkingpublished on every check, a download after a failed re-read, no wait for the in-flight check inrestart()and indownload(), and anonErrorthat ignores a running check. The fake engine emitserrorwhen a check or download rejects, as electron-updater does.tsc --noEmit,vp lint, andvp fmt --checkpass.