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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Commenting
Marek Trunkatbcb1d9d495a6
diff --git a/src/request_queue.js b/src/request_queue.jsindex 1ae769c53..2990fb7a6 100644--- a/src/request_queue.js+++ b/src/request_queue.js@@ -721,6 +721,8 @@ export class RequestQueueLocal {if (!request.handledAt) request.handledAt = new Date();+ // NOTE: First write to old file and then rename to new one to do the operation atomically.+ // Situation where two files exists at the same time may cause race condition bugs.return writeFilePromised(source, JSON.stringify(request, null, 4)).then(() => renamePromised(source, dest)).then(() => {@@ -754,6 +756,8 @@ export class RequestQueueLocal {this.requestIdToQueueOrderNo[request.id] = newQueueOrderNo;this.queueOrderNoInProgress[newQueueOrderNo] = true;+ // NOTE: First write to old file and then rename to new one to do the operation atomically.+ // Situation where two files exists at the same time may cause race condition bugs.return writeFilePromised(source, JSON.stringify(request, null, 4)).then(() => renamePromised(source, dest)).then(() => {