We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5fe95f1 commit 23f37a8Copy full SHA for 23f37a8
packages/crawl/src/crawl.ts
@@ -18,6 +18,22 @@ async function loadSitemapWithoutRetries(sitemapUrl: string): Promise<string[]>
18
if (!response.ok) {
19
throw new Error(`Sitemap not found: ${response.status}`)
20
}
21
+ const controller = new AbortController()
22
+ const timeoutId = setTimeout(() => controller.abort(), 10000) // 10 second timeout
23
+
24
+ try {
25
+ const response = await fetch(sitemapUrl, {
26
+ signal: controller.signal,
27
+ headers: {
28
+ 'User-Agent': 'mdream-crawler/1.0',
29
+ },
30
+ })
31
32
+ clearTimeout(timeoutId)
33
34
+ if (!response.ok) {
35
+ throw new Error(`Sitemap not found: ${response.status}`)
36
+ }
37
38
const xmlContent = await response.text()
39
0 commit comments