Skip to content

Commit 3ea9388

Browse files
fix refresh all failure bug
1 parent a5756f9 commit 3ea9388

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/appConfigurationImpl.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,21 +590,19 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
590590
* Updates etag of watched settings from loaded data. If a watched setting is not covered by any selector, a request will be sent to retrieve it.
591591
*/
592592
async #updateWatchedKeyValuesEtag(existingSettings: ConfigurationSetting[]): Promise<void> {
593+
const updatedSentinels: ConfigurationSettingId[] = [];
593594
for (const sentinel of this.#sentinels) {
594595
const matchedSetting = existingSettings.find(s => s.key === sentinel.key && s.label === sentinel.label);
595596
if (matchedSetting) {
596-
sentinel.etag = matchedSetting.etag;
597+
updatedSentinels.push( {...sentinel, etag: matchedSetting.etag} );
597598
} else {
598599
// Send a request to retrieve key-value since it may be either not loaded or loaded with a different label or different casing
599600
const { key, label } = sentinel;
600601
const response = await this.#getConfigurationSetting({ key, label });
601-
if (response) {
602-
sentinel.etag = response.etag;
603-
} else {
604-
sentinel.etag = undefined;
605-
}
602+
updatedSentinels.push( {...sentinel, etag: response?.etag} );
606603
}
607604
}
605+
this.#sentinels = updatedSentinels;
608606
}
609607

610608
/**
@@ -662,7 +660,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
662660
if (response?.statusCode === 200 // created or changed
663661
|| (response === undefined && sentinel.etag !== undefined) // deleted
664662
) {
665-
sentinel.etag = response?.etag;// update etag of the sentinel
666663
needRefresh = true;
667664
break;
668665
}

0 commit comments

Comments
 (0)