Streamline update mode configuration and handling#323206
Draft
dmitrivMS wants to merge 7 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes update.mode: "none" not reliably stopping automatic updates (notably on Windows background updates) by making update-mode changes apply at runtime and ensuring in-flight work is cancelled when updates are disabled.
Changes:
- Refactors
AbstractUpdateServiceto reconfigure itself onupdate.modechanges (enable/disable without restart) and to cancel scheduled checks when disabling. - Adds Windows-specific cancellation of in-flight check/download chains so disabling updates at runtime prevents reaching the background installer.
- Updates
update.modesetting/policy descriptions to remove the “Requires a restart” claim, and removes restart-on-change handling from the relauncher contribution. - Adds unit tests covering startup and runtime transitions for
update.mode.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts | Stops treating update.mode changes as requiring a workbench relaunch. |
| src/vs/platform/update/test/electron-main/abstractUpdateService.test.ts | Adds tests for startup/runtime behavior of update.mode, including cancellation and permanent disablement. |
| src/vs/platform/update/electron-main/updateService.win32.ts | Introduces a cancellation token for the check/download chain and cancels it when updates are disabled at runtime. |
| src/vs/platform/update/electron-main/updateService.linux.ts | Prevents mid-check disablement from flipping state back out of Disabled by ignoring late results/errors. |
| src/vs/platform/update/electron-main/updateService.darwin.ts | Switches raw autoUpdater event subscriptions to use the base Disposable store. |
| src/vs/platform/update/electron-main/abstractUpdateService.ts | Centralizes runtime update-mode reconfiguration, scheduling, and disable/cancel logic. |
| src/vs/platform/update/common/update.config.contribution.ts | Updates configuration/policy descriptions to reflect no-restart behavior for update.mode. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Low
Comment on lines
+492
to
+499
| protected override async cancelUpdate(): Promise<void> { | ||
| // Abort an in-flight check/download so it never reaches the background installer. | ||
| this.checkCancellationTokenSource?.dispose(true); | ||
| this.checkCancellationTokenSource = undefined; | ||
|
|
||
| // Tear down any pending (downloaded/applying) update. | ||
| await this.cancelPendingUpdate(); | ||
| } |
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.
Fixes #289144