mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-08 19:29:02 +08:00
Nick: sitemap fetch only below threshold for /map
This commit is contained in:
parent
c7b219169b
commit
ac0d10c451
@ -155,15 +155,19 @@ export async function getMapResults({
|
||||
await redis.set(cacheKey, JSON.stringify(allResults), "EX", 48 * 60 * 60); // Cache for 48 hours
|
||||
}
|
||||
|
||||
// Parallelize sitemap fetch with serper search and sitemap-index
|
||||
const [_, sitemapIndexUrls, ...searchResults] = await Promise.all([
|
||||
ignoreSitemap ? null : crawler.tryGetSitemap(urls => {
|
||||
links.push(...urls);
|
||||
}, true, false, 30000),
|
||||
// Parallelize sitemap index query with search results
|
||||
const [sitemapIndexUrls, ...searchResults] = await Promise.all([
|
||||
querySitemapIndex(url),
|
||||
...(cachedResult ? [] : pagePromises),
|
||||
]);
|
||||
|
||||
// Only query sitemap if index has less than 100 links
|
||||
if (!ignoreSitemap && sitemapIndexUrls.length < 100) {
|
||||
await crawler.tryGetSitemap(urls => {
|
||||
links.push(...urls);
|
||||
}, true, false, 30000);
|
||||
}
|
||||
|
||||
if (!cachedResult) {
|
||||
allResults = searchResults;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user