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

Plugin localization service does not await on init #11853

Merged
merged 1 commit into from
Nov 14, 2022

Conversation

kittaakos
Copy link
Contributor

What it does

  • This PR changes the initialization (BackendApplicationContribution#initialize) of the localization service for plugins. With the proposed changes, the backend initialization does not wait for the cleaning of the localization cache folder.
  • The PR also changes the return type of the initialize method from Promise<void> to MaybePromise<void> not to force downstream projects to use aync/Promise when doing the customization.

Why?

To speed up the backend startup when the Theia-based app is stated with multiple languages.

Originally from here:

I am seeing slow startup time with multiple languages. It's more than a sec.

2022-11-09T11:46:27.180Z root WARN Backend HostedPluginLocalizationService.initialize took longer than the expected maximum 50 milliseconds: 1070.7 ms [Finished 4.488 s after backend start]

Could something like this also work in Theia?

initialize(): void {
	this.getLocalizationCacheDir().then((cacheDir) => fs.emptyDir(cacheDir)).then(() => this._ready.resolve())
}

With the proposed change, the initialization is significantly less.

2022-11-09T12:05:46.544Z root INFO Backend HostedPluginLocalizationService.initialize: 3.0 ms [Finished 2.557 s after backend start]

Thank you!

How to test

Review checklist

Reminder for reviewers

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, that looks good to me 👍

@msujew msujew merged commit 79abfc4 into eclipse-theia:master Nov 14, 2022
@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility localization issues related to localization/internalization/nls labels Nov 24, 2022
@vince-fugnitto vince-fugnitto added this to the 1.32.0 milestone Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
localization issues related to localization/internalization/nls vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants