Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore previous behavior of onDidChangeSecret #187334

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 6 additions & 21 deletions src/vs/platform/secrets/common/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SequencerByKey } from 'vs/base/common/async';
import { IEncryptionService } from 'vs/platform/encryption/common/encryptionService';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService, InMemoryStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { Event, PauseableEmitter } from 'vs/base/common/event';
import { Emitter, Event } from 'vs/base/common/event';
import { ILogService } from 'vs/platform/log/common/log';
import { IDisposable } from 'vs/base/common/lifecycle';

Expand All @@ -30,7 +30,7 @@ export abstract class BaseSecretStorageService implements ISecretStorageService

private _storagePrefix = 'secret://';

private readonly _onDidChangeSecret = new PauseableEmitter<string>();
private readonly _onDidChangeSecret = new Emitter<string>();
onDidChangeSecret: Event<string> = this._onDidChangeSecret.event;

protected readonly _sequencer = new SequencerByKey<string>();
Expand All @@ -55,11 +55,6 @@ export abstract class BaseSecretStorageService implements ISecretStorageService
return;
}

if (this._onDidChangeSecret.isPaused) {
this._logService.trace(`[SecretStorageService] Skipping change event for secret: ${key} because it is paused`);
return;
}

const secretKey = key.slice(this._storagePrefix.length);

this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${secretKey}`);
Expand Down Expand Up @@ -104,13 +99,8 @@ export abstract class BaseSecretStorageService implements ISecretStorageService
throw e;
}
const fullKey = this.getKey(key);
try {
this._onDidChangeSecret.pause();
this._logService.trace('[secrets] storing encrypted secret for key:', fullKey);
storageService.store(fullKey, encrypted, StorageScope.APPLICATION, StorageTarget.MACHINE);
} finally {
this._onDidChangeSecret.resume();
}
this._logService.trace('[secrets] storing encrypted secret for key:', fullKey);
storageService.store(fullKey, encrypted, StorageScope.APPLICATION, StorageTarget.MACHINE);
this._logService.trace('[secrets] stored encrypted secret for key:', fullKey);
});
}
Expand All @@ -120,13 +110,8 @@ export abstract class BaseSecretStorageService implements ISecretStorageService
const storageService = await this.resolvedStorageService;

const fullKey = this.getKey(key);
try {
this._onDidChangeSecret.pause();
this._logService.trace('[secrets] deleting secret for key:', fullKey);
storageService.remove(fullKey, StorageScope.APPLICATION);
} finally {
this._onDidChangeSecret.resume();
}
this._logService.trace('[secrets] deleting secret for key:', fullKey);
storageService.remove(fullKey, StorageScope.APPLICATION);
this._logService.trace('[secrets] deleted secret for key:', fullKey);
});
}
Expand Down