@@ -49,10 +49,10 @@ type SettingSelectorCollection = {
4949 selectors : PagedSettingSelector [ ] ;
5050
5151 /**
52- * The etag which has changed after the last refresh. This is used to append to the request url for breaking the CDN cache.
53- * It can either be a page etag or etag of a watched setting.
52+ * This is used to append to the request url for breaking the CDN cache.
53+ * It uses the etag which has changed after the last refresh. It can either be a page etag or etag of a watched setting.
5454 */
55- etagToBreakCdnCache ?: string ;
55+ cdnCacheBreakString ?: string ;
5656}
5757
5858export class AzureAppConfigurationImpl implements AzureAppConfiguration {
@@ -252,21 +252,21 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
252252 // use the first page etag of the first kv selector
253253 const defaultSelector = this . #kvSelectorCollection. selectors . find ( s => s . pageEtags !== undefined ) ;
254254 if ( defaultSelector && defaultSelector . pageEtags ! . length > 0 ) {
255- this . #kvSelectorCollection. etagToBreakCdnCache = defaultSelector . pageEtags ! [ 0 ] ;
255+ this . #kvSelectorCollection. cdnCacheBreakString = defaultSelector . pageEtags ! [ 0 ] ;
256256 } else {
257- this . #kvSelectorCollection. etagToBreakCdnCache = undefined ;
257+ this . #kvSelectorCollection. cdnCacheBreakString = undefined ;
258258 }
259259 } else if ( this . #refreshEnabled) { // watched settings based refresh
260260 // use the etag of the first watched setting (sentinel)
261- this . #kvSelectorCollection. etagToBreakCdnCache = this . #sentinels. find ( s => s . etag !== undefined ) ?. etag ;
261+ this . #kvSelectorCollection. cdnCacheBreakString = this . #sentinels. find ( s => s . etag !== undefined ) ?. etag ;
262262 }
263263
264264 if ( this . #featureFlagRefreshEnabled) {
265265 const defaultSelector = this . #ffSelectorCollection. selectors . find ( s => s . pageEtags !== undefined ) ;
266266 if ( defaultSelector && defaultSelector . pageEtags ! . length > 0 ) {
267- this . #ffSelectorCollection. etagToBreakCdnCache = defaultSelector . pageEtags ! [ 0 ] ;
267+ this . #ffSelectorCollection. cdnCacheBreakString = defaultSelector . pageEtags ! [ 0 ] ;
268268 } else {
269- this . #ffSelectorCollection. etagToBreakCdnCache = undefined ;
269+ this . #ffSelectorCollection. cdnCacheBreakString = undefined ;
270270 }
271271 }
272272 }
@@ -413,7 +413,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
413413 if ( this . #isCdnUsed) {
414414 listOptions = {
415415 ...listOptions ,
416- requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : selectorCollection . etagToBreakCdnCache ?? "" } }
416+ requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : selectorCollection . cdnCacheBreakString ?? "" } }
417417 } ;
418418 }
419419
@@ -479,7 +479,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
479479 // Send a request to retrieve watched key-value since it may be either not loaded or loaded with a different selector
480480 // If cdn is used, add etag to request header so that the pipeline policy can retrieve and append it to the request URL
481481 const getOptions = this . #isCdnUsed ?
482- { requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : this . #kvSelectorCollection. etagToBreakCdnCache ?? "" } } } :
482+ { requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : this . #kvSelectorCollection. cdnCacheBreakString ?? "" } } } :
483483 { } ;
484484 const response = await this . #getConfigurationSetting( sentinel , { ...getOptions , onlyIfChanged : false } ) ; // always send non-conditional request
485485 sentinel . etag = response ?. etag ;
@@ -532,15 +532,15 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
532532 for ( const sentinel of this . #sentinels. values ( ) ) {
533533 // If cdn is used, add etag to request header so that the pipeline policy can retrieve and append it to the request URL
534534 const getOptions = this . #isCdnUsed ?
535- { requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : this . #kvSelectorCollection. etagToBreakCdnCache ?? "" } } } :
535+ { requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : this . #kvSelectorCollection. cdnCacheBreakString ?? "" } } } :
536536 { } ;
537537 const response = await this . #getConfigurationSetting( sentinel , { ...getOptions , onlyIfChanged : ! this . #isCdnUsed } ) ; // if CDN is used, do not send conditional request
538538
539539 if ( ( response ?. statusCode === 200 && sentinel . etag !== response ?. etag ) ||
540540 ( response === undefined && sentinel . etag !== undefined ) // deleted
541541 ) {
542542 sentinel . etag = response ?. etag ; // update etag of the sentinel
543- this . #kvSelectorCollection. etagToBreakCdnCache = sentinel . etag ;
543+ this . #kvSelectorCollection. cdnCacheBreakString = sentinel . etag ;
544544 needRefresh = true ;
545545 break ;
546546 }
@@ -590,7 +590,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
590590 // If cdn is used, add etag to request header so that the pipeline policy can retrieve and append it to the request URL
591591 listOptions = {
592592 ...listOptions ,
593- requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : selectorCollection . etagToBreakCdnCache ?? "" } } } ;
593+ requestOptions : { customHeaders : { [ ETAG_LOOKUP_HEADER ] : selectorCollection . cdnCacheBreakString ?? "" } } } ;
594594 } else {
595595 // send conditional request if cdn is not used
596596 listOptions = { ...listOptions , pageEtags : selector . pageEtags } ;
@@ -603,7 +603,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
603603 ) . byPage ( ) ;
604604
605605 if ( selector . pageEtags === undefined || selector . pageEtags . length === 0 ) {
606- selectorCollection . etagToBreakCdnCache = undefined ;
606+ selectorCollection . cdnCacheBreakString = undefined ;
607607 return true ; // no etag is retrieved from previous request, always refresh
608608 }
609609
@@ -612,15 +612,15 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
612612 if ( i >= selector . pageEtags . length || // new page
613613 ( page . _response . status === 200 && page . etag !== selector . pageEtags [ i ] ) ) { // page changed
614614 if ( this . #isCdnUsed) {
615- selectorCollection . etagToBreakCdnCache = page . etag ;
615+ selectorCollection . cdnCacheBreakString = page . etag ;
616616 }
617617 return true ;
618618 }
619619 i ++ ;
620620 }
621621 if ( i !== selector . pageEtags . length ) { // page removed
622622 if ( this . #isCdnUsed) {
623- selectorCollection . etagToBreakCdnCache = selector . pageEtags [ i ] ;
623+ selectorCollection . cdnCacheBreakString = selector . pageEtags [ i ] ;
624624 }
625625 return true ;
626626 }
0 commit comments