@studyportals/fawkes 8.7.2-23 → 8.7.2-24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,18 +21,24 @@ export class RankedCountryDiscipline extends RankedOrganisationsSeoIndexabilityP
|
|
|
21
21
|
const countryFragments = CountryPresenter.getInstance().getFragments();
|
|
22
22
|
const disciplineFragments = DisciplinePresenter.getInstance().getFragments();
|
|
23
23
|
const paths = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const concurrencyLimit = 5; // Process 5 combinations concurrently
|
|
25
|
+
// Create all combinations
|
|
26
|
+
const combinations = countryFragments.flatMap(country => disciplineFragments.map(discipline => ({ country, discipline })));
|
|
27
|
+
// Process in batches to respect API rate limits
|
|
28
|
+
for (let i = 0; i < combinations.length; i += concurrencyLimit) {
|
|
29
|
+
const batch = combinations.slice(i, i + concurrencyLimit);
|
|
30
|
+
const results = await Promise.all(batch.map(async ({ country, discipline }) => {
|
|
27
31
|
const filterKeyValues = new Map([
|
|
28
32
|
[FilterKey.COUNTRY, [country.id]],
|
|
29
33
|
[FilterKey.DISCIPLINES, [discipline.id]]
|
|
30
34
|
]);
|
|
31
35
|
const result = await this.checkRulesForSitemap(filterKeyValues);
|
|
32
36
|
if (result) {
|
|
33
|
-
|
|
37
|
+
return this.getPathWithSortingOption(`${country.path}/${discipline.path}`);
|
|
34
38
|
}
|
|
35
|
-
|
|
39
|
+
return null;
|
|
40
|
+
}));
|
|
41
|
+
paths.push(...results.filter((path) => path !== null));
|
|
36
42
|
}
|
|
37
43
|
return paths;
|
|
38
44
|
}
|