Skip to content

Commit 95c6233

Browse files
committed
update
1 parent 8e0d552 commit 95c6233

3 files changed

Lines changed: 3 additions & 21 deletions

File tree

src/keyValueAdapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export interface IKeyValueAdapter {
1515
processKeyValue(setting: ConfigurationSetting): Promise<[string, unknown]>;
1616

1717
/**
18-
* Optionally batch-resolves settings ahead of processKeyValue, e.g. to deduplicate and warm up
19-
* Key Vault secret requests so that processKeyValue only reads from cache.
18+
* This method deduplicates and warms up Key Vault secret requests so that processKeyValue only reads from cache.
2019
*/
2120
preload?(settings: ConfigurationSetting[]): Promise<void>;
2221

src/keyvault/keyVaultKeyValueAdapter.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ export class AzureKeyVaultKeyValueAdapter implements IKeyValueAdapter {
4949
}
5050
}
5151

52-
/**
53-
* Deduplicates secret references by their normalized secret identifier (sourceId) and preloads each
54-
* unique secret exactly once, warming the cache so that processKeyValue only reads from it.
55-
* Best-effort: unparseable references are skipped and re-surfaced by processKeyValue with full context.
56-
*/
5752
async preload(settings: ConfigurationSetting[]): Promise<void> {
5853
if (!this.#keyVaultOptions) {
5954
return; // nothing to do; processKeyValue will throw the proper ArgumentError

src/keyvault/keyVaultSecretProvider.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ export class AzureKeyVaultSecretProvider {
3333
}
3434
}
3535

36-
/**
37-
* Fetches the given unique secrets ahead of resolution to warm the cache. Honors the secret refresh
38-
* timer and the parallel resolution option. This is best-effort: per-secret failures are swallowed so
39-
* that the error is surfaced with full context later by getSecretValue during resolution.
40-
*/
36+
// Fetches the given unique secrets to warm the cache.
4137
async preloadSecrets(secretIdentifiers: KeyVaultSecretIdentifier[]): Promise<void> {
4238
const loadSecret = async (secretIdentifier: KeyVaultSecretIdentifier) => {
4339
try {
@@ -56,10 +52,6 @@ export class AzureKeyVaultSecretProvider {
5652
}
5753
}
5854

59-
/**
60-
* Fetches a secret value into the cache if it is not cached yet, or if the secret refresh interval has
61-
* expired. This is the only place the refresh timer gates a fetch.
62-
*/
6355
async #loadSecretValue(secretIdentifier: KeyVaultSecretIdentifier): Promise<void> {
6456
const identifierKey = secretIdentifier.sourceId;
6557
const shouldRefresh = this.#secretRefreshTimer?.canRefresh() ?? false;
@@ -71,15 +63,11 @@ export class AzureKeyVaultSecretProvider {
7163

7264
async getSecretValue(secretIdentifier: KeyVaultSecretIdentifier): Promise<unknown> {
7365
const identifierKey = secretIdentifier.sourceId;
74-
75-
// Return the cached value if available. Freshness is handled by preloadSecrets, which warms the
76-
// cache before resolution.
7766
if (this.#cachedSecretValues.has(identifierKey)) {
7867
return this.#cachedSecretValues.get(identifierKey);
7968
}
8069

81-
// Fallback for secrets that preload skipped or failed to fetch. Failures are not cached, so a
82-
// subsequent call will retry.
70+
// Fallback for secrets that preload skipped or failed to fetch.
8371
const secretValue = await this.#getSecretValueFromKeyVault(secretIdentifier);
8472
this.#cachedSecretValues.set(identifierKey, secretValue);
8573
return secretValue;

0 commit comments

Comments
 (0)