Skip to content

Commit 61e4a65

Browse files
not use conditional request
1 parent 635ca48 commit 61e4a65

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/AzureAppConfigurationImpl.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
510510
const listOptions: ListConfigurationSettingsOptions = {
511511
keyFilter: selector.keyFilter,
512512
labelFilter: selector.labelFilter,
513-
pageEtags: selector.pageEtags
513+
...(!this.#isCdnUsed && { pageEtags: selector.pageEtags }) // if CDN is used, do not send conditional request
514514
};
515515

516516
const pageIterator = listConfigurationSettingsWithTrace(
@@ -519,10 +519,20 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
519519
listOptions
520520
).byPage();
521521

522+
if (selector.pageEtags === undefined || selector.pageEtags.length === 0) {
523+
return true; // no etag, always refresh
524+
}
525+
526+
let i = 0;
522527
for await (const page of pageIterator) {
523-
if (page._response.status === 200) { // created or changed
528+
if (i > selector.pageEtags.length + 1 || // new page
529+
(page._response.status === 200 && page.etag !== selector.pageEtags[i])) { // page changed
524530
return true;
525531
}
532+
i++;
533+
}
534+
if (i !== selector.pageEtags.length) { // page removed
535+
return true;
526536
}
527537
}
528538
return false;

0 commit comments

Comments
 (0)