From fcfab425fcd35ef9ca58c92bf54bdd446c1f097c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 22 Nov 2018 15:11:19 +0100 Subject: [PATCH] storage - do not wait for init when storage is known to not exist --- src/vs/platform/storage/node/storageService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/storage/node/storageService.ts b/src/vs/platform/storage/node/storageService.ts index bbc54b9afe9..15031d95a63 100644 --- a/src/vs/platform/storage/node/storageService.ts +++ b/src/vs/platform/storage/node/storageService.ts @@ -7,7 +7,7 @@ import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle'; import { Event, Emitter } from 'vs/base/common/event'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; import { IWorkspaceStorageChangeEvent, IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { Storage, IStorageLoggingOptions, NullStorage, IStorage } from 'vs/base/node/storage'; +import { Storage, IStorageLoggingOptions, NullStorage, IStorage, StorageHint } from 'vs/base/node/storage'; import { IStorageLegacyService, StorageLegacyScope } from 'vs/platform/storage/common/storageLegacyService'; import { startsWith, endsWith } from 'vs/base/common/strings'; import { Action } from 'vs/base/common/actions'; @@ -98,7 +98,7 @@ export class StorageService extends Disposable implements IStorageService { // Workspace Storage (in-memory only, other users require the initalize() call) if (options.storeInMemory) { - this.createWorkspaceStorage(Storage.IN_MEMORY_PATH); + this.createWorkspaceStorage(Storage.IN_MEMORY_PATH, StorageHint.STORAGE_DOES_NOT_EXIST); } } @@ -130,7 +130,7 @@ export class StorageService extends Disposable implements IStorageService { // Create workspace storage and initalize mark('willInitWorkspaceStorage'); - return this.createWorkspaceStorage(workspaceStoragePath).init().then(() => { + return this.createWorkspaceStorage(workspaceStoragePath, result.wasCreated ? StorageHint.STORAGE_DOES_NOT_EXIST : void 0).init().then(() => { mark('didInitWorkspaceStorage'); // Migrate storage if this is the first start and we are not using in-memory @@ -275,7 +275,7 @@ export class StorageService extends Disposable implements IStorageService { }); } - private createWorkspaceStorage(workspaceStoragePath: string): IStorage { + private createWorkspaceStorage(workspaceStoragePath: string, hint?: StorageHint): IStorage { // Dispose old (if any) this.workspaceStorage = dispose(this.workspaceStorage); @@ -283,7 +283,7 @@ export class StorageService extends Disposable implements IStorageService { // Create new this.workspaceStoragePath = workspaceStoragePath; - this.workspaceStorage = new Storage({ path: workspaceStoragePath, logging: this.loggingOptions }); + this.workspaceStorage = new Storage({ path: workspaceStoragePath, logging: this.loggingOptions, hint }); this.workspaceStorageListener = this.workspaceStorage.onDidChangeStorage(key => this.handleDidChangeStorage(key, StorageScope.WORKSPACE)); return this.workspaceStorage; -- GitLab