Skip to content

Commit b843906

Browse files
author
Benjamin Pasero
committed
sqlite - selfhost on DB, bump storage delay
1 parent f0a2aa5 commit b843906

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/vs/base/node/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ enum StorageState {
3333
export class Storage extends Disposable {
3434
_serviceBrand: any;
3535

36-
private static readonly FLUSH_DELAY = 10;
36+
private static readonly FLUSH_DELAY = 100;
3737

3838
private _onDidChangeStorage: Emitter<string> = this._register(new Emitter<string>());
3939
get onDidChangeStorage(): Event<string> { return this._onDidChangeStorage.event; }

src/vs/platform/storage/electron-browser/storageService.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { IStorageLegacyService, StorageLegacyScope } from 'vs/platform/storage/c
1313
import { addDisposableListener } from 'vs/base/browser/dom';
1414
import { startsWith } from 'vs/base/common/strings';
1515
import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
16-
import { isUndefinedOrNull } from 'vs/base/common/types';
1716

1817
export class StorageService extends Disposable implements IStorageService {
1918
_serviceBrand: any;
@@ -133,34 +132,34 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
133132
}
134133

135134
get(key: string, scope: StorageScope, fallbackValue?: any): string {
136-
const dbValue = this.storageService.get(key, scope);
137135
const localStorageValue = this.storageLegacyService.get(key, this.convertScope(scope), fallbackValue);
136+
const dbValue = this.storageService.get(key, scope, localStorageValue);
138137

139138
this.assertStorageValue(key, scope, dbValue, localStorageValue);
140139

141-
return localStorageValue;
140+
return dbValue;
142141
}
143142

144143
getBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean {
145-
const dbValue = this.storageService.getBoolean(key, scope);
146144
const localStorageValue = this.storageLegacyService.getBoolean(key, this.convertScope(scope), fallbackValue);
145+
const dbValue = this.storageService.getBoolean(key, scope, localStorageValue);
147146

148147
this.assertStorageValue(key, scope, dbValue, localStorageValue);
149148

150-
return localStorageValue;
149+
return dbValue;
151150
}
152151

153152
getInteger(key: string, scope: StorageScope, fallbackValue?: number): number {
154-
const dbValue = this.storageService.getInteger(key, scope);
155153
const localStorageValue = this.storageLegacyService.getInteger(key, this.convertScope(scope), fallbackValue);
154+
const dbValue = this.storageService.getInteger(key, scope, localStorageValue);
156155

157156
this.assertStorageValue(key, scope, dbValue, localStorageValue);
158157

159-
return localStorageValue;
158+
return dbValue;
160159
}
161160

162161
private assertStorageValue(key: string, scope: StorageScope, dbValue: any, storageValue: any): void {
163-
if (!isUndefinedOrNull(dbValue) && dbValue !== storageValue) {
162+
if (dbValue !== storageValue) {
164163
this.logService.error(`Unexpected storage value (key: ${key}, scope: ${scope === StorageScope.GLOBAL ? 'global' : 'workspace'}), actual: ${dbValue}, expected: ${storageValue}`);
165164
}
166165
}

0 commit comments

Comments
 (0)