diff --git a/package-lock.json b/package-lock.json index 87cf916..1b99f9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4359,13 +4359,13 @@ } }, "node_modules/playwright": { - "version": "1.55.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz", - "integrity": "sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==", + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", + "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.55.0" + "playwright-core": "1.56.1" }, "bin": { "playwright": "cli.js" @@ -4378,9 +4378,9 @@ } }, "node_modules/playwright-core": { - "version": "1.55.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz", - "integrity": "sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==", + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", + "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -5319,9 +5319,9 @@ } }, "node_modules/vite": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz", - "integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==", + "version": "7.1.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz", + "integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/appConfigurationImpl.ts b/src/appConfigurationImpl.ts index b6e6194..ecfdc9e 100644 --- a/src/appConfigurationImpl.ts +++ b/src/appConfigurationImpl.ts @@ -627,23 +627,22 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration { // try refresh if any of watched settings is changed. let needRefresh = false; - let changedSentinel; - let changedSentinelWatcher; + let changedSentinel: WatchedSetting | undefined; + let changedSentinelWatcher: SettingWatcher | undefined; if (this.#watchAll) { needRefresh = await this.#checkConfigurationSettingsChange(this.#kvSelectors); } else { for (const watchedSetting of this.#sentinels.keys()) { const configurationSettingId: ConfigurationSettingId = { key: watchedSetting.key, label: watchedSetting.label, etag: this.#sentinels.get(watchedSetting)?.etag }; - const response = await this.#getConfigurationSetting(configurationSettingId, { - onlyIfChanged: true - }); - - const watcher = this.#sentinels.get(watchedSetting); - if (response?.statusCode === 200 // created or changed - || (response === undefined && watcher?.etag !== undefined) // deleted - ) { + const response: GetConfigurationSettingResponse | undefined + = await this.#getConfigurationSetting(configurationSettingId, { onlyIfChanged: true }); + + const watcher: SettingWatcher = this.#sentinels.get(watchedSetting)!; // watcher should always exist for sentinels + const isDeleted = response === undefined && watcher.etag !== undefined; // previously existed, now deleted + const isChanged = response && response.statusCode === 200 && watcher.etag !== response.etag; // etag changed + if (isDeleted || isChanged) { changedSentinel = watchedSetting; - changedSentinelWatcher = watcher; + changedSentinelWatcher = { etag: isChanged ? response.etag : undefined }; needRefresh = true; break; } @@ -655,7 +654,11 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration { await adapter.onChangeDetected(); } await this.#loadSelectedKeyValues(); - this.#sentinels.set(changedSentinel, changedSentinelWatcher); // update the changed sentinel's watcher + + if (changedSentinel && changedSentinelWatcher) { + // update the changed sentinel's watcher after loading new values, this can ensure a failed refresh will retry on next refresh + this.#sentinels.set(changedSentinel, changedSentinelWatcher); + } } this.#kvRefreshTimer.reset();