mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-08 15:55:15 +01:00
add logging for extension auto updates (#244842)
This commit is contained in:
committed by
GitHub
parent
27df383fbf
commit
e8f4239a6f
@@ -1065,13 +1065,13 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
if (e.affectsConfiguration(AutoCheckUpdatesConfigurationKey)) {
|
||||
if (this.isAutoCheckUpdatesEnabled()) {
|
||||
this.checkForUpdates();
|
||||
this.checkForUpdates(`Enabled auto check updates`);
|
||||
}
|
||||
}
|
||||
}));
|
||||
this._register(this.extensionEnablementService.onEnablementChanged(platformExtensions => {
|
||||
if (this.getAutoUpdateValue() === 'onlyEnabledExtensions' && platformExtensions.some(e => this.extensionEnablementService.isEnabled(e))) {
|
||||
this.checkForUpdates();
|
||||
this.checkForUpdates('Extension enablement changed');
|
||||
}
|
||||
}));
|
||||
this._register(Event.debounce(this.onChange, () => undefined, 100)(() => this.hasOutdatedExtensionsContextKey.set(this.outdated.length > 0)));
|
||||
@@ -1082,14 +1082,14 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
comment: 'Report when update check is triggered on product update';
|
||||
}>('extensions:updatecheckonproductupdate');
|
||||
if (this.isAutoCheckUpdatesEnabled()) {
|
||||
this.checkForUpdates();
|
||||
this.checkForUpdates('Product update');
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
this._register(this.allowedExtensionsService.onDidChangeAllowedExtensionsConfigValue(() => {
|
||||
if (this.isAutoCheckUpdatesEnabled()) {
|
||||
this.checkForUpdates();
|
||||
this.checkForUpdates('Allowed extensions changed');
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -1827,7 +1827,12 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
return ExtensionState.Uninstalled;
|
||||
}
|
||||
|
||||
async checkForUpdates(onlyBuiltin?: boolean): Promise<void> {
|
||||
async checkForUpdates(reason?: string, onlyBuiltin?: boolean): Promise<void> {
|
||||
if (reason) {
|
||||
this.logService.info(`[Extensions]: Checking for updates. Reason: ${reason}`);
|
||||
} else {
|
||||
this.logService.trace(`[Extensions]: Checking for updates`);
|
||||
}
|
||||
if (!this.galleryService.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -1872,6 +1877,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
this.telemetryService.publicLog2<GalleryServiceUpdatesCheckEvent, GalleryServiceUpdatesCheckClassification>('galleryService:checkingForUpdates', {
|
||||
count: infos.length,
|
||||
});
|
||||
this.logService.trace(`Checking updates for extensions`, infos.map(e => e.id).join(', '));
|
||||
const galleryExtensions = await this.galleryService.getExtensions(infos, { targetPlatform, compatible: true, productVersion: this.getProductVersion(), preferResourceApi: true }, CancellationToken.None);
|
||||
if (galleryExtensions.length) {
|
||||
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
|
||||
@@ -1963,6 +1969,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
await Promise.allSettled(extensions.map(extensions => extensions.syncInstalledExtensionsWithGallery(gallery, this.getProductVersion())));
|
||||
if (this.outdated.length) {
|
||||
this.logService.info(`Auto updating outdated extensions.`, this.outdated.map(e => e.identifier.id).join(', '));
|
||||
this.eventuallyAutoUpdateExtensions();
|
||||
}
|
||||
}
|
||||
@@ -1994,7 +2001,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
private async autoUpdateBuiltinExtensions(): Promise<void> {
|
||||
await this.checkForUpdates(true);
|
||||
await this.checkForUpdates(undefined, true);
|
||||
const toUpdate = this.outdated.filter(e => e.isBuiltin);
|
||||
await Promises.settled(toUpdate.map(e => this.install(e, e.local?.preRelease ? { installPreReleaseVersion: true } : undefined)));
|
||||
}
|
||||
@@ -2018,9 +2025,11 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
const toUpdate: IExtension[] = [];
|
||||
for (const extension of this.outdated) {
|
||||
if (!this.shouldAutoUpdateExtension(extension)) {
|
||||
this.logService.info('Auto update disabled for extension', extension.identifier.id);
|
||||
continue;
|
||||
}
|
||||
if (await this.shouldRequireConsentToUpdate(extension)) {
|
||||
this.logService.info('Auto update consent required for extension', extension.identifier.id);
|
||||
continue;
|
||||
}
|
||||
toUpdate.push(extension);
|
||||
@@ -2031,7 +2040,10 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
const productVersion = this.getProductVersion();
|
||||
await Promises.settled(toUpdate.map(e => this.install(e, e.local?.preRelease ? { installPreReleaseVersion: true, productVersion } : { productVersion })));
|
||||
await Promises.settled(toUpdate.map(e => {
|
||||
this.logService.info('Auto updating extension', e.identifier.id);
|
||||
return this.install(e, e.local?.preRelease ? { installPreReleaseVersion: true, productVersion } : { productVersion });
|
||||
}));
|
||||
}
|
||||
|
||||
private getProductVersion(): IProductVersion {
|
||||
|
||||
Reference in New Issue
Block a user