Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

refactor: make the last resort timeout much larger

Martin Adámek9f46835a971a
diff --git a/src/crawlers/basic_crawler.js b/src/crawlers/basic_crawler.js
index 382a9519b..ce8d72ce2 100644
--- a/src/crawlers/basic_crawler.js
+++ b/src/crawlers/basic_crawler.js
@@ -475,10 +475,11 @@ export class BasicCrawler {
* @private
*/
async timeoutForRunTaskFunction() {
+ const timeout = 600e3; // 10 min last resort timeout for stuck runs
await addTimeoutToPromise(
() => this._runTaskFunction(),
- this.handleRequestTimeoutMillis * 2,
- `_runTaskFunction timed out after ${(this.handleRequestTimeoutMillis * 2) / 1000} seconds.`,
+ timeout,
+ `_runTaskFunction timed out after ${(timeout) / 1000} seconds.`,
);
}