mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-05 16:27:16 +00:00
debt: remove migrations (#236239)
* debt: remove migrations * remove migration test
This commit is contained in:
committed by
GitHub
parent
466eb0be75
commit
70409435e5
@@ -593,10 +593,7 @@ export abstract class AbstractSynchroniser extends Disposable implements IUserDa
|
||||
}
|
||||
|
||||
async getLastSyncUserData(): Promise<IRemoteUserData | null> {
|
||||
let storedLastSyncUserDataStateContent = this.getStoredLastSyncUserDataStateContent();
|
||||
if (!storedLastSyncUserDataStateContent) {
|
||||
storedLastSyncUserDataStateContent = await this.migrateLastSyncUserData();
|
||||
}
|
||||
const storedLastSyncUserDataStateContent = this.getStoredLastSyncUserDataStateContent();
|
||||
|
||||
// Last Sync Data state does not exist
|
||||
if (!storedLastSyncUserDataStateContent) {
|
||||
@@ -704,30 +701,6 @@ export abstract class AbstractSynchroniser extends Disposable implements IUserDa
|
||||
await this.fileService.writeFile(this.lastSyncResource, VSBuffer.fromString(JSON.stringify(lastSyncRemoteUserData)));
|
||||
}
|
||||
|
||||
private async migrateLastSyncUserData(): Promise<string | undefined> {
|
||||
try {
|
||||
const content = await this.fileService.readFile(this.lastSyncResource);
|
||||
const userData = JSON.parse(content.value.toString());
|
||||
await this.fileService.del(this.lastSyncResource);
|
||||
if (userData.ref && userData.content !== undefined) {
|
||||
this.storageService.store(this.lastSyncUserDataStateKey, JSON.stringify({
|
||||
...userData,
|
||||
content: undefined,
|
||||
}), StorageScope.APPLICATION, StorageTarget.MACHINE);
|
||||
await this.writeLastSyncStoredRemoteUserData({ ref: userData.ref, syncData: userData.content === null ? null : JSON.parse(userData.content) });
|
||||
} else {
|
||||
this.logService.info(`${this.syncResourceLogLabel}: Migrating last sync user data. Invalid data.`, userData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof FileOperationError && error.fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
|
||||
this.logService.info(`${this.syncResourceLogLabel}: Migrating last sync user data. Resource does not exist.`);
|
||||
} else {
|
||||
this.logService.error(error);
|
||||
}
|
||||
}
|
||||
return this.storageService.get(this.lastSyncUserDataStateKey, StorageScope.APPLICATION);
|
||||
}
|
||||
|
||||
async getRemoteUserData(lastSyncData: IRemoteUserData | null): Promise<IRemoteUserData> {
|
||||
const { ref, content } = await this.getUserData(lastSyncData);
|
||||
let syncData: ISyncData | null = null;
|
||||
|
||||
@@ -82,14 +82,6 @@ export class IgnoredExtensionsManagementService implements IIgnoredExtensionsMan
|
||||
}
|
||||
|
||||
private getConfiguredIgnoredExtensions(): ReadonlyArray<string> {
|
||||
let userValue = this.configurationService.inspect<string[]>('settingsSync.ignoredExtensions').userValue;
|
||||
if (userValue !== undefined) {
|
||||
return userValue;
|
||||
}
|
||||
userValue = this.configurationService.inspect<string[]>('sync.ignoredExtensions').userValue;
|
||||
if (userValue !== undefined) {
|
||||
return userValue;
|
||||
}
|
||||
return (this.configurationService.getValue<string[]>('settingsSync.ignoredExtensions') || []).map(id => id.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1380,48 +1380,6 @@ suite('TestSynchronizer - Last Sync Data', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('last sync data is migrated', async () => {
|
||||
await runWithFakedTimers<void>({}, async () => {
|
||||
const storageService = client.instantiationService.get(IStorageService);
|
||||
const fileService = client.instantiationService.get(IFileService);
|
||||
const testObject: TestSynchroniser = disposableStore.add(client.instantiationService.createInstance(TestSynchroniser, { syncResource: SyncResource.Settings, profile: client.instantiationService.get(IUserDataProfilesService).defaultProfile }, undefined));
|
||||
const machineId = await testObject.getMachineId();
|
||||
await fileService.writeFile(testObject.getLastSyncResource(), VSBuffer.fromString(JSON.stringify({
|
||||
ref: '1',
|
||||
version: 1,
|
||||
content: JSON.stringify({
|
||||
content: '0',
|
||||
machineId,
|
||||
version: 1
|
||||
}),
|
||||
additionalData: {
|
||||
foo: 'bar'
|
||||
}
|
||||
})));
|
||||
|
||||
const actual = await testObject.getLastSyncUserData();
|
||||
|
||||
assert.deepStrictEqual(storageService.get('settings.lastSyncUserData', StorageScope.APPLICATION), JSON.stringify({
|
||||
ref: '1',
|
||||
version: 1,
|
||||
additionalData: {
|
||||
foo: 'bar'
|
||||
}
|
||||
}));
|
||||
assert.deepStrictEqual(actual, {
|
||||
ref: '1',
|
||||
version: 1,
|
||||
syncData: {
|
||||
content: '0',
|
||||
machineId,
|
||||
version: 1
|
||||
},
|
||||
additionalData: {
|
||||
foo: 'bar'
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function assertConflicts(actual: IBaseResourcePreview[], expected: URI[]) {
|
||||
|
||||
Reference in New Issue
Block a user