Reorder eager extension activation (#176706)

* Handle all pending operations right after opening barrier

---------

Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
This commit is contained in:
Joyce Er
2023-03-16 16:21:50 -07:00
committed by GitHub
parent 8cc6bd0255
commit e440a9bb7d
2 changed files with 12 additions and 0 deletions

View File

@@ -193,6 +193,14 @@ export class ExtensionsActivator implements IDisposable {
}
}
public async waitForActivatingExtensions(): Promise<void> {
const res: Promise<boolean>[] = [];
for (const [_, op] of this._operations) {
res.push(op.wait());
}
await Promise.all(res);
}
public isActivated(extensionId: ExtensionIdentifier): boolean {
const op = this._operations.get(extensionId);
return Boolean(op && op.value);

View File

@@ -756,6 +756,10 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return this._readyToStartExtensionHost.wait()
.then(() => this._readyToRunExtensions.open())
.then(() => {
// wait for all activation events that came in during workbench startup, but at maximum 1s
return Promise.race([this._activator.waitForActivatingExtensions(), timeout(1000)]);
})
.then(() => this._handleEagerExtensions())
.then(() => {
this._eagerExtensionsActivated.open();