Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThemeService registers configuration late triggering change event #101226

Closed
bpasero opened this issue Jun 28, 2020 · 9 comments
Closed

ThemeService registers configuration late triggering change event #101226

bpasero opened this issue Jun 28, 2020 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders perf-startup themes Color theme issues verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jun 28, 2020

image

Is there a reason that this call is made from the constructor and not statically outside:

configurationRegistry.registerConfiguration(themeSettingsConfiguration);

This triggers a onDefaultConfigurationChange event that clocks at 16ms on startup.

//cc @jrieken @sandy081

@bpasero bpasero added themes Color theme issues perf-startup labels Jun 28, 2020
@aeschli
Copy link
Contributor

aeschli commented Jun 29, 2020

The default value of the configuration is defined in the constructor (it uses the environment service). Modifying the default value of an existing configuration are problematic/not allowed.

@sandy081 Any advice?

Can the configuration service wait with sending out the event until all services have been created?

@jrieken
Copy link
Member

jrieken commented Jun 30, 2020

Can the configuration service wait with sending out the event until all services have been created?

💯 for that. Maybe risky but I am also for not sending change events while starting up and then send one combined event once things are initialised

@sandy081
Copy link
Member

Configuration service is created in the very beginning with no dependencies on other services. So it is tricky deferring firing events until some lifecycle phase.

@bpasero Is it possible to have lifecycle service along with initial services?

@bpasero
Copy link
Member Author

bpasero commented Jun 30, 2020

Is it possible to have lifecycle service along with initial services?

You mean to depend on lifecycle service? Yes, why not?

@sandy081
Copy link
Member

yeah, configuration service depending on lifecycle service.

@bpasero
Copy link
Member Author

bpasero commented Jun 30, 2020

Yeah I think that might work, in the end not a lot of dependencies:

constructor(
@INotificationService private readonly notificationService: INotificationService,
@IElectronService private readonly electronService: IElectronService,
@IStorageService readonly storageService: IStorageService,
@ILogService readonly logService: ILogService
) {

This would mean we need to move lifecycle creation into the list of services we create eagerly. And probably need to move notification service as well.

In general I am not a big fan of adding more services to the list of services we create manually and not via registerSingleton.

@sandy081
Copy link
Member

I can think of two options

  1. Move necessary lifecycle services to create manually during start up as initial services and add dependency (Ideal)
  2. Expose an API on configuration service to start triggering events which workbench can call when all services are created.

Let me know which is the better option.

@bpasero
Copy link
Member Author

bpasero commented Jun 30, 2020

Actually, 1. is not straight forward as the storage service is used inside notification service but both init in parallel with the config service...

@bpasero
Copy link
Member Author

bpasero commented Jun 30, 2020

However, maybe we could simply introduce a new ILifecyclePhaseService which does not have any dependencies, should be no problem to extract this and adopt it.

@aeschli aeschli added this to the August 2020 milestone Aug 24, 2020
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Aug 24, 2020
@bpasero bpasero added the verified Verification succeeded label Sep 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders perf-startup themes Color theme issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@bpasero @jrieken @aeschli @sandy081 and others