refactor: drop db migration patch (#5519)
* refactor: remove database migration patch & test Drop migration code since it's been 6 months since 4.0.2 and we no longer need this. See: https://github.com/coder/code-server/issues/5482#issuecomment-1222608635 * chore: refresh patches
This commit is contained in:
@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
|
||||
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
|
||||
return false;
|
||||
}
|
||||
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
|
||||
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
|
||||
// Skip if check updates only for builtin extensions and current extension is not builtin.
|
||||
continue;
|
||||
}
|
||||
|
@ -104,6 +104,13 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
|
||||
- sendErrorTelemetry: this.sendErrorTelemetry,
|
||||
- };
|
||||
- this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
|
||||
-
|
||||
- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
|
||||
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
|
||||
- // This is most likely due to ad blockers
|
||||
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
|
||||
- this.impl = NullTelemetryService;
|
||||
- });
|
||||
+ const telemetryProvider: ITelemetryAppender | undefined = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : productService.aiConfig?.ariaKey ? new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey) : undefined;
|
||||
+ if (telemetryProvider) {
|
||||
+ appenders.push(telemetryProvider);
|
||||
@ -114,13 +121,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
|
||||
+ sendErrorTelemetry: this.sendErrorTelemetry,
|
||||
+ };
|
||||
+ this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
|
||||
|
||||
- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
|
||||
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
|
||||
- // This is most likely due to ad blockers
|
||||
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
|
||||
- this.impl = NullTelemetryService;
|
||||
- });
|
||||
+
|
||||
+ if (remoteAgentService.getConnection() === null && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
|
||||
+ // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
|
||||
+ // This is most likely due to ad blockers
|
||||
|
@ -9,11 +9,6 @@ ensures that different browser paths will be unique (for example /workspace1 and
|
||||
The easiest way to test is to open files in the same workspace using both / and
|
||||
/vscode and make sure they are not interacting with each other.
|
||||
|
||||
It should also migrate old databases which can be tested by opening in an old
|
||||
code-server.
|
||||
|
||||
This has e2e tests.
|
||||
|
||||
Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
|
||||
@ -39,29 +34,3 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +146,25 @@ export class BrowserStorageService exten
|
||||
|
||||
await this.workspaceStorage.init();
|
||||
|
||||
+ const firstWorkspaceOpen = this.workspaceStorage.getBoolean(IS_NEW_KEY);
|
||||
+ if (firstWorkspaceOpen === undefined) {
|
||||
+ // Migrate the old database.
|
||||
+ let db: IIndexedDBStorageDatabase | undefined
|
||||
+ try {
|
||||
+ db = await IndexedDBStorageDatabase.create({ id: this.payload.id }, this.logService)
|
||||
+ const items = await db.getItems()
|
||||
+ for (const [key, value] of items) {
|
||||
+ this.workspaceStorage.set(key, value);
|
||||
+ }
|
||||
+ } catch (error) {
|
||||
+ this.logService.error(`[IndexedDB Storage ${this.payload.id}] migrate error: ${toErrorMessage(error)}`);
|
||||
+ } finally {
|
||||
+ if (db) {
|
||||
+ db.close()
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
this.updateIsNew(this.workspaceStorage);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user