File tree Expand file tree Collapse file tree
src/vs/code/electron-main Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,14 +358,15 @@ export class CodeApplication extends Disposable {
358358 }
359359
360360 private async resolveMachineId ( ) : Promise < string > {
361- let machineId = this . stateService . getItem < string > ( CodeApplication . MACHINE_ID_KEY ) ;
362- if ( machineId ) {
363- return machineId ;
364- }
365361
366- machineId = await getMachineId ( ) ;
362+ // We cache the machineId for faster lookups on startup
363+ // and resolve it only once initially if not cached
364+ let machineId = this . stateService . getItem < string > ( CodeApplication . MACHINE_ID_KEY ) ;
365+ if ( ! machineId ) {
366+ machineId = await getMachineId ( ) ;
367367
368- this . stateService . setItem ( CodeApplication . MACHINE_ID_KEY , machineId ) ;
368+ this . stateService . setItem ( CodeApplication . MACHINE_ID_KEY , machineId ) ;
369+ }
369370
370371 return machineId ;
371372 }
@@ -462,7 +463,6 @@ export class CodeApplication extends Disposable {
462463 this . lifecycleService . onWillShutdown ( e => e . join ( storageMainService . close ( ) ) ) ;
463464
464465 return Promise . resolve ( ) ;
465-
466466 }
467467
468468 private initBackupService ( accessor : ServicesAccessor ) : Promise < void > {
@@ -580,8 +580,8 @@ export class CodeApplication extends Disposable {
580580 } ) ;
581581 }
582582
583+ // mac: open-file event received on startup
583584 if ( macOpenFiles && macOpenFiles . length && ! hasCliArgs && ! hasFolderURIs && ! hasFileURIs ) {
584- // mac: open-file event received on startup
585585 return this . windowsMainService . open ( {
586586 context : OpenContext . DOCK ,
587587 cli : args ,
You can’t perform that action at this time.
0 commit comments