mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
check pre-release flag on local extension while syncing - to avoid multiple queries to get compatible extension
This commit is contained in:
parent
05de5834b0
commit
7334561f2b
|
@ -1005,27 +1005,41 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
|||
.then(undefined, err => null);
|
||||
}
|
||||
|
||||
private syncWithGallery(): Promise<void> {
|
||||
const ids: string[] = [], names: string[] = [];
|
||||
private async syncWithGallery(): Promise<void> {
|
||||
const ids: string[] = [], preReleaseIds: string[] = [], names: string[] = [], preReleaseNames: string[] = [];
|
||||
for (const installed of this.local) {
|
||||
if (installed.type === ExtensionType.User) {
|
||||
if (installed.identifier.uuid) {
|
||||
ids.push(installed.identifier.uuid);
|
||||
if (installed.local?.isPreReleaseVersion || installed.local?.preRelease) {
|
||||
preReleaseIds.push(installed.identifier.uuid);
|
||||
} else {
|
||||
ids.push(installed.identifier.uuid);
|
||||
}
|
||||
} else {
|
||||
names.push(installed.identifier.id);
|
||||
if (installed.local?.isPreReleaseVersion || installed.local?.preRelease) {
|
||||
preReleaseNames.push(installed.identifier.id);
|
||||
} else {
|
||||
names.push(installed.identifier.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const promises: Promise<IPager<IExtension>>[] = [];
|
||||
if (ids.length) {
|
||||
promises.push(this.queryGallery({ ids, pageSize: ids.length }, CancellationToken.None));
|
||||
promises.push(this.queryGallery({ ids, pageSize: ids.length, includePreRelease: false }, CancellationToken.None));
|
||||
}
|
||||
if (preReleaseIds.length) {
|
||||
promises.push(this.queryGallery({ ids: preReleaseIds, pageSize: preReleaseIds.length, includePreRelease: true }, CancellationToken.None));
|
||||
}
|
||||
if (names.length) {
|
||||
promises.push(this.queryGallery({ names, pageSize: names.length }, CancellationToken.None));
|
||||
promises.push(this.queryGallery({ names, pageSize: names.length, includePreRelease: false }, CancellationToken.None));
|
||||
}
|
||||
if (preReleaseNames.length) {
|
||||
promises.push(this.queryGallery({ names: preReleaseNames, pageSize: names.length, includePreRelease: true }, CancellationToken.None));
|
||||
}
|
||||
|
||||
return Promises.settled(promises).then(() => undefined);
|
||||
await Promises.settled(promises);
|
||||
}
|
||||
|
||||
private eventuallyAutoUpdateExtensions(): void {
|
||||
|
|
Loading…
Reference in a new issue