@@ -364,7 +364,14 @@ export class CodeApplication extends Disposable {
364
364
365
365
// Spawn shared process after the first window has opened and 3s have passed
366
366
const sharedProcess = this . instantiationService . createInstance ( SharedProcess , machineId , this . userEnv ) ;
367
- const sharedProcessClient = sharedProcess . whenReady ( ) . then ( ( ) => connect ( this . environmentService . sharedIPCHandle , 'main' ) ) ;
367
+ const sharedProcessClient = sharedProcess . whenIpcReady ( ) . then ( ( ) => {
368
+ this . logService . trace ( 'Shared process: IPC ready' ) ;
369
+ return connect ( this . environmentService . sharedIPCHandle , 'main' ) ;
370
+ } ) ;
371
+ const sharedProcessReady = sharedProcess . whenReady ( ) . then ( ( ) => {
372
+ this . logService . trace ( 'Shared process: init ready' ) ;
373
+ return sharedProcessClient ;
374
+ } ) ;
368
375
this . lifecycleMainService . when ( LifecycleMainPhase . AfterWindowOpen ) . then ( ( ) => {
369
376
this . _register ( new RunOnceScheduler ( async ( ) => {
370
377
const userEnv = await getShellEnvironment ( this . logService , this . environmentService ) ;
@@ -374,7 +381,7 @@ export class CodeApplication extends Disposable {
374
381
} ) ;
375
382
376
383
// Services
377
- const appInstantiationService = await this . createServices ( machineId , trueMachineId , sharedProcess , sharedProcessClient ) ;
384
+ const appInstantiationService = await this . createServices ( machineId , trueMachineId , sharedProcess , sharedProcessReady ) ;
378
385
379
386
// Create driver
380
387
if ( this . environmentService . driverHandle ) {
@@ -424,7 +431,7 @@ export class CodeApplication extends Disposable {
424
431
return { machineId, trueMachineId } ;
425
432
}
426
433
427
- private async createServices ( machineId : string , trueMachineId : string | undefined , sharedProcess : SharedProcess , sharedProcessClient : Promise < Client < string > > ) : Promise < IInstantiationService > {
434
+ private async createServices ( machineId : string , trueMachineId : string | undefined , sharedProcess : SharedProcess , sharedProcessReady : Promise < Client < string > > ) : Promise < IInstantiationService > {
428
435
const services = new ServiceCollection ( ) ;
429
436
430
437
const fileService = this . _register ( new FileService ( this . logService ) ) ;
@@ -456,7 +463,7 @@ export class CodeApplication extends Disposable {
456
463
services . set ( ISharedProcessMainService , new SyncDescriptor ( SharedProcessMainService , [ sharedProcess ] ) ) ;
457
464
services . set ( ILaunchMainService , new SyncDescriptor ( LaunchMainService ) ) ;
458
465
459
- const diagnosticsChannel = getDelayedChannel ( sharedProcessClient . then ( client => client . getChannel ( 'diagnostics' ) ) ) ;
466
+ const diagnosticsChannel = getDelayedChannel ( sharedProcessReady . then ( client => client . getChannel ( 'diagnostics' ) ) ) ;
460
467
services . set ( IDiagnosticsService , new SyncDescriptor ( DiagnosticsService , [ diagnosticsChannel ] ) ) ;
461
468
462
469
services . set ( IIssueService , new SyncDescriptor ( IssueMainService , [ machineId , this . userEnv ] ) ) ;
@@ -477,7 +484,7 @@ export class CodeApplication extends Disposable {
477
484
478
485
// Telemetry
479
486
if ( ! this . environmentService . isExtensionDevelopment && ! this . environmentService . args [ 'disable-telemetry' ] && ! ! product . enableTelemetry ) {
480
- const channel = getDelayedChannel ( sharedProcessClient . then ( client => client . getChannel ( 'telemetryAppender' ) ) ) ;
487
+ const channel = getDelayedChannel ( sharedProcessReady . then ( client => client . getChannel ( 'telemetryAppender' ) ) ) ;
481
488
const appender = combinedAppender ( new TelemetryAppenderClient ( channel ) , new LogAppender ( this . logService ) ) ;
482
489
const commonProperties = resolveCommonProperties ( product . commit , product . version , machineId , product . msftInternalDomains , this . environmentService . installSourcePath ) ;
483
490
const piiPaths = this . environmentService . extensionsPath ? [ this . environmentService . appRoot , this . environmentService . extensionsPath ] : [ this . environmentService . appRoot ] ;
@@ -571,6 +578,7 @@ export class CodeApplication extends Disposable {
571
578
const storageMainService = accessor . get ( IStorageMainService ) ;
572
579
const storageChannel = this . _register ( new GlobalStorageDatabaseChannel ( this . logService , storageMainService ) ) ;
573
580
electronIpcServer . registerChannel ( 'storage' , storageChannel ) ;
581
+ sharedProcessClient . then ( client => client . registerChannel ( 'storage' , storageChannel ) ) ;
574
582
575
583
const loggerChannel = new LoggerChannel ( accessor . get ( ILogService ) ) ;
576
584
electronIpcServer . registerChannel ( 'logger' , loggerChannel ) ;
0 commit comments