Skip to content

Commit 6e34f62

Browse files
resolve merge conflict
1 parent 8ed48b5 commit 6e34f62

File tree

1 file changed

+0
-102
lines changed

1 file changed

+0
-102
lines changed

src/AzureAppConfigurationImpl.ts

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,11 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
9393
/**
9494
* Selectors of key-values obtained from @see AzureAppConfigurationOptions.selectors
9595
*/
96-
<<<<<<< HEAD
9796
#kvSelectorCollection: SettingSelectorCollection = { selectors: [] };
9897
/**
9998
* Selectors of feature flags obtained from @see AzureAppConfigurationOptions.featureFlagOptions.selectors
10099
*/
101100
#ffSelectorCollection: SettingSelectorCollection = { selectors: [] };
102-
=======
103-
#kvSelectors: PagedSettingSelector[] = [];
104-
/**
105-
* Selectors of feature flags obtained from @see AzureAppConfigurationOptions.featureFlagOptions.selectors
106-
*/
107-
#ffSelectors: PagedSettingSelector[] = [];
108-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
109101

110102
// Load balancing
111103
#lastSuccessfulEndpoint: string = "";
@@ -132,9 +124,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
132124
this.#sortedTrimKeyPrefixes = [...options.trimKeyPrefixes].sort((a, b) => b.localeCompare(a));
133125
}
134126

135-
// if no selector is specified, always load key values using the default selector: key="*" and label="\0"
136-
this.#kvSelectors = getValidKeyValueSelectors(options?.selectors);
137-
138127
if (options?.refreshOptions?.enabled) {
139128
const { refreshIntervalInMs, watchedSettings } = options.refreshOptions;
140129
if (watchedSettings === undefined || watchedSettings.length === 0) {
@@ -167,13 +156,8 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
167156

168157
// feature flag options
169158
if (options?.featureFlagOptions?.enabled) {
170-
<<<<<<< HEAD
171159
// validate feature flag selectors
172160
this.#ffSelectorCollection.selectors = getValidFeatureFlagSelectors(options.featureFlagOptions.selectors);
173-
=======
174-
// validate feature flag selectors, only load feature flags when enabled
175-
this.#ffSelectors = getValidFeatureFlagSelectors(options.featureFlagOptions.selectors);
176-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
177161

178162
if (options.featureFlagOptions.refresh?.enabled) {
179163
const { refreshIntervalInMs } = options.featureFlagOptions.refresh;
@@ -213,10 +197,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
213197
initialLoadCompleted: this.#isInitialLoadCompleted,
214198
replicaCount: this.#clientManager.getReplicaCount(),
215199
isFailoverRequest: this.#isFailoverRequest,
216-
<<<<<<< HEAD
217200
isCdnUsed: this.#isCdnUsed,
218-
=======
219-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
220201
featureFlagTracing: this.#featureFlagTracing
221202
};
222203
}
@@ -414,7 +395,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
414395
* If false, loads key-value using the key-value selectors. Defaults to false.
415396
*/
416397
async #loadConfigurationSettings(loadFeatureFlag: boolean = false): Promise<ConfigurationSetting[]> {
417-
<<<<<<< HEAD
418398
const selectorCollection = loadFeatureFlag ? this.#ffSelectorCollection : this.#kvSelectorCollection;
419399
const funcToExecute = async (client) => {
420400
const loadedSettings: ConfigurationSetting[] = [];
@@ -437,41 +417,20 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
437417
};
438418
}
439419

440-
=======
441-
const selectors = loadFeatureFlag ? this.#ffSelectors : this.#kvSelectors;
442-
const funcToExecute = async (client) => {
443-
const loadedSettings: ConfigurationSetting[] = [];
444-
// deep copy selectors to avoid modification if current client fails
445-
const selectorsToUpdate = JSON.parse(
446-
JSON.stringify(selectors)
447-
);
448-
449-
for (const selector of selectorsToUpdate) {
450-
const listOptions: ListConfigurationSettingsOptions = {
451-
keyFilter: selector.keyFilter,
452-
labelFilter: selector.labelFilter
453-
};
454-
455-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
456420
const pageEtags: string[] = [];
457421
const pageIterator = listConfigurationSettingsWithTrace(
458422
this.#requestTraceOptions,
459423
client,
460424
listOptions
461425
).byPage();
462426
for await (const page of pageIterator) {
463-
<<<<<<< HEAD
464427
pageEtags.push(page.etag ?? ""); // pageEtags is string[]
465-
=======
466-
pageEtags.push(page.etag ?? "");
467-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
468428
for (const setting of page.items) {
469429
if (loadFeatureFlag === isFeatureFlag(setting)) {
470430
loadedSettings.push(setting);
471431
}
472432
}
473433
}
474-
<<<<<<< HEAD
475434

476435
if (pageEtags.length === 0) {
477436
console.warn(`No page is found in the response of listing key-value selector: key=${selector.keyFilter} and label=${selector.labelFilter}.`);
@@ -480,16 +439,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
480439
}
481440

482441
selectorCollection.selectors = selectorsToUpdate;
483-
=======
484-
selector.pageEtags = pageEtags;
485-
}
486-
487-
if (loadFeatureFlag) {
488-
this.#ffSelectors = selectorsToUpdate;
489-
} else {
490-
this.#kvSelectors = selectorsToUpdate;
491-
}
492-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
493442
return loadedSettings;
494443
};
495444

@@ -527,24 +476,13 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
527476
if (matchedSetting) {
528477
sentinel.etag = matchedSetting.etag;
529478
} else {
530-
<<<<<<< HEAD
531479
// Send a request to retrieve watched key-value since it may be either not loaded or loaded with a different selector
532480
// If cdn is used, add etag to request header so that the pipeline policy can retrieve and append it to the request URL
533481
const getOptions = this.#isCdnUsed ?
534482
{ requestOptions: { customHeaders: { [ETAG_LOOKUP_HEADER]: this.#kvSelectorCollection.etagToBreakCdnCache ?? "" } } } :
535483
{};
536484
const response = await this.#getConfigurationSetting(sentinel, {...getOptions, onlyIfChanged: false}); // always send non-conditional request
537485
sentinel.etag = response?.etag;
538-
=======
539-
// Send a request to retrieve key-value since it may be either not loaded or loaded with a different label or different casing
540-
const { key, label } = sentinel;
541-
const response = await this.#getConfigurationSetting({ key, label });
542-
if (response) {
543-
sentinel.etag = response.etag;
544-
} else {
545-
sentinel.etag = undefined;
546-
}
547-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
548486
}
549487
}
550488
}
@@ -589,7 +527,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
589527
// try refresh if any of watched settings is changed.
590528
let needRefresh = false;
591529
if (this.#watchAll) {
592-
<<<<<<< HEAD
593530
needRefresh = await this.#checkConfigurationSettingsChange(this.#kvSelectorCollection);
594531
}
595532
for (const sentinel of this.#sentinels.values()) {
@@ -604,19 +541,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
604541
) {
605542
sentinel.etag = response?.etag;// update etag of the sentinel
606543
this.#kvSelectorCollection.etagToBreakCdnCache = sentinel.etag;
607-
=======
608-
needRefresh = await this.#checkConfigurationSettingsChange(this.#kvSelectors);
609-
}
610-
for (const sentinel of this.#sentinels.values()) {
611-
const response = await this.#getConfigurationSetting(sentinel, {
612-
onlyIfChanged: true
613-
});
614-
615-
if (response?.statusCode === 200 // created or changed
616-
|| (response === undefined && sentinel.etag !== undefined) // deleted
617-
) {
618-
sentinel.etag = response?.etag;// update etag of the sentinel
619-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
620544
needRefresh = true;
621545
break;
622546
}
@@ -640,11 +564,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
640564
return Promise.resolve(false);
641565
}
642566

643-
<<<<<<< HEAD
644567
const needRefresh = await this.#checkConfigurationSettingsChange(this.#ffSelectorCollection);
645-
=======
646-
const needRefresh = await this.#checkConfigurationSettingsChange(this.#ffSelectors);
647-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
648568
if (needRefresh) {
649569
await this.#loadFeatureFlags();
650570
}
@@ -655,7 +575,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
655575

656576
/**
657577
* Checks whether the key-value collection has changed.
658-
<<<<<<< HEAD
659578
* @param selectorCollection - The @see SettingSelectorCollection of the kev-value collection.
660579
* @returns true if key-value collection has changed, false otherwise.
661580
*/
@@ -677,27 +596,12 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
677596
listOptions = { ...listOptions, pageEtags: selector.pageEtags };
678597
}
679598

680-
=======
681-
* @param selectors - The @see PagedSettingSelector of the kev-value collection.
682-
* @returns true if key-value collection has changed, false otherwise.
683-
*/
684-
async #checkConfigurationSettingsChange(selectors: PagedSettingSelector[]): Promise<boolean> {
685-
const funcToExecute = async (client) => {
686-
for (const selector of selectors) {
687-
const listOptions: ListConfigurationSettingsOptions = {
688-
keyFilter: selector.keyFilter,
689-
labelFilter: selector.labelFilter,
690-
pageEtags: selector.pageEtags
691-
};
692-
693-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
694599
const pageIterator = listConfigurationSettingsWithTrace(
695600
this.#requestTraceOptions,
696601
client,
697602
listOptions
698603
).byPage();
699604

700-
<<<<<<< HEAD
701605
if (selector.pageEtags === undefined || selector.pageEtags.length === 0) {
702606
selectorCollection.etagToBreakCdnCache = undefined;
703607
return true; // no etag is retrieved from previous request, always refresh
@@ -719,12 +623,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
719623
selectorCollection.etagToBreakCdnCache = selector.pageEtags[i];
720624
}
721625
return true;
722-
=======
723-
for await (const page of pageIterator) {
724-
if (page._response.status === 200) { // created or changed
725-
return true;
726-
}
727-
>>>>>>> 71aebabca61a3e3fa5df2b7112b1236768932408
728626
}
729627
}
730628
return false;

0 commit comments

Comments
 (0)