提交 b843906c 编写于 作者: B Benjamin Pasero

sqlite - selfhost on DB, bump storage delay

上级 f0a2aa55
......@@ -33,7 +33,7 @@ enum StorageState {
export class Storage extends Disposable {
_serviceBrand: any;
private static readonly FLUSH_DELAY = 10;
private static readonly FLUSH_DELAY = 100;
private _onDidChangeStorage: Emitter<string> = this._register(new Emitter<string>());
get onDidChangeStorage(): Event<string> { return this._onDidChangeStorage.event; }
......
......@@ -13,7 +13,6 @@ import { IStorageLegacyService, StorageLegacyScope } from 'vs/platform/storage/c
import { addDisposableListener } from 'vs/base/browser/dom';
import { startsWith } from 'vs/base/common/strings';
import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { isUndefinedOrNull } from 'vs/base/common/types';
export class StorageService extends Disposable implements IStorageService {
_serviceBrand: any;
......@@ -133,34 +132,34 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
}
get(key: string, scope: StorageScope, fallbackValue?: any): string {
const dbValue = this.storageService.get(key, scope);
const localStorageValue = this.storageLegacyService.get(key, this.convertScope(scope), fallbackValue);
const dbValue = this.storageService.get(key, scope, localStorageValue);
this.assertStorageValue(key, scope, dbValue, localStorageValue);
return localStorageValue;
return dbValue;
}
getBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean {
const dbValue = this.storageService.getBoolean(key, scope);
const localStorageValue = this.storageLegacyService.getBoolean(key, this.convertScope(scope), fallbackValue);
const dbValue = this.storageService.getBoolean(key, scope, localStorageValue);
this.assertStorageValue(key, scope, dbValue, localStorageValue);
return localStorageValue;
return dbValue;
}
getInteger(key: string, scope: StorageScope, fallbackValue?: number): number {
const dbValue = this.storageService.getInteger(key, scope);
const localStorageValue = this.storageLegacyService.getInteger(key, this.convertScope(scope), fallbackValue);
const dbValue = this.storageService.getInteger(key, scope, localStorageValue);
this.assertStorageValue(key, scope, dbValue, localStorageValue);
return localStorageValue;
return dbValue;
}
private assertStorageValue(key: string, scope: StorageScope, dbValue: any, storageValue: any): void {
if (!isUndefinedOrNull(dbValue) && dbValue !== storageValue) {
if (dbValue !== storageValue) {
this.logService.error(`Unexpected storage value (key: ${key}, scope: ${scope === StorageScope.GLOBAL ? 'global' : 'workspace'}), actual: ${dbValue}, expected: ${storageValue}`);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册