From 4bfa2f866db4bdb94ec57c0b83d54f1b23c67bae Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 18 Nov 2024 09:17:14 +0100 Subject: [PATCH] Validating device ID slows down window opening (fix #234064) (#234065) --- src/vs/code/electron-main/app.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index d8880a9b34f36..11ca66e8767c1 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -622,7 +622,14 @@ export class CodeApplication extends Disposable { // Set lifecycle phase to `Eventually` after a short delay and when idle (min 2.5sec, max 5sec) const eventuallyPhaseScheduler = this._register(new RunOnceScheduler(() => { - this._register(runWhenGlobalIdle(() => this.lifecycleMainService.phase = LifecycleMainPhase.Eventually, 2500)); + this._register(runWhenGlobalIdle(() => { + + // Signal phase: eventually + this.lifecycleMainService.phase = LifecycleMainPhase.Eventually; + + // Eventually Post Open Window Tasks + this.eventuallyAfterWindowOpen(); + }, 2500)); }, 2500)); eventuallyPhaseScheduler.schedule(); } @@ -1373,9 +1380,6 @@ export class CodeApplication extends Disposable { if (isMacintosh && app.runningUnderARM64Translation) { this.windowsMainService?.sendToFocused('vscode:showTranslatedBuildWarning'); } - - // Validate Device ID is up to date - validatedevDeviceId(this.stateService, this.logService); } private async installMutex(): Promise { @@ -1451,4 +1455,11 @@ export class CodeApplication extends Disposable { this.windowsMainService?.sendToFocused('vscode:showArgvParseWarning'); } } + + private eventuallyAfterWindowOpen(): void { + + // Validate Device ID is up to date (delay this as it has shown significant perf impact) + // Refs: https://github.com/microsoft/vscode/issues/234064 + validatedevDeviceId(this.stateService, this.logService); + } }