Skip to content

Commit

Permalink
fix: recursive call
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiAlexandruParaschiv committed Aug 14, 2024
1 parent 54a4a5a commit ac20bbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/sitemap/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,16 @@ export async function getBaseUrlPagesFromSitemaps(baseUrl, urls, log) {
if (urlData.existsAndIsValid) {
if (urlData.details && urlData.details.isSitemapIndex) {
log.info(`Sitemap Index found: ${url}`);
// eslint-disable-next-line max-len
// Ensure we await the result of getSitemapUrlsFromSitemapIndex
// eslint-disable-next-line no-await-in-loop,max-len
const extractedSitemaps = getSitemapUrlsFromSitemapIndex(urlData.details.sitemapContent, log, fetchContent);
log.info(`Extracted Sitemaps from Index: ${extractedSitemaps}`);
log.info(`Extracted Sitemaps from Index: ${JSON.stringify(extractedSitemaps)}`);

for (const extractedSitemapUrl of extractedSitemaps) {
if (!contentsCache[extractedSitemapUrl]) {
matchingUrls.push(extractedSitemapUrl);
try {
// Fetch contents for each sitemap URL
// eslint-disable-next-line no-await-in-loop
await fillSitemapContents(extractedSitemapUrl);
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export async function getSitemapUrlsFromSitemapIndex(content, log, fetchContent)
for (const sitemapUrl of sitemapUrls) {
log.info(`Processing sitemap: ${sitemapUrl}`);

// Fetch the content of each sitemap URL
try {
// Fetch the content of each sitemap URL
// eslint-disable-next-line no-await-in-loop
const sitemapContent = await fetchContent(sitemapUrl);

Expand Down

0 comments on commit ac20bbf

Please sign in to comment.