Skip to content

Commit edd560d

Browse files
author
Benjamin Pasero
committed
💄 - introduce CodeMain
1 parent bda5098 commit edd560d

2 files changed

Lines changed: 188 additions & 185 deletions

File tree

src/vs/code/electron-main/app.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)