-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix extension loader race conditions #1815
Conversation
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
const bundledExtensions = await this.loadBundledExtensions(); | ||
|
||
await this.installPackages(); // install in-tree as a separate step | ||
const localExtensions = await this.loadFromFolder(this.localFolderPath); | ||
await this.installPackages(this.packageJsonPath, bundledExtensions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We install only bundled extensions here, but when do we install user extensions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We install them only when they are added.
extensionDiscovery.init(); | ||
windowManager = WindowManager.getInstance<WindowManager>(proxyPort); | ||
|
||
// call after windowManager to see splash earlier | ||
try { | ||
const extensions = await extensionDiscovery.load(); | ||
|
||
// Start watching after bundled extensions are loaded | ||
extensionDiscovery.watchExtensions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this is broken, watchExtensions contains await this.whenLoaded;
which is set at the end of load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably revert this, I did separate these just to understand the current flow better.
// The path to the manifest file is the lens extension id | ||
// Note that we need to use the symlinked path | ||
const lensExtensionId = path.join(this.nodeModulesPath, extensionName, manifestFilename); | ||
const lensExtensionId = extension.manifestPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we actually remove this variable and use extension.id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes if they are the same thing.. I just tried to keep this compatible with current logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should be the same. In the old implementation the id was created manually because we didn't have the extension object itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#48320
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
|
||
await this.installPackages(); | ||
const extensions = bundledExtensions.concat(localExtensions); | ||
const userExtensions = await this.loadFromFolder(this.localFolderPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be good, in a future PR, to remove the dependence on this folder so that we can no longer use explicit symlinks and instead have a list of "dev" extensions to just require
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be good improvement (but cannot be done in a patch release).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay sounds good. Maybe 4.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4.1 is already quite loaded but we can try.
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
* fix extension loader race conditions Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix tests Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix remove Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * ensure symlinked (dev) extensions are installed on boot Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
Fixes following issues: