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.

chore(hotfix): Fix SitemapRequestList persist state event binding, vol. 2 (#2926)

Jan Buchar6a1192aa2e01
diff --git a/packages/core/src/storages/sitemap_request_list.ts b/packages/core/src/storages/sitemap_request_list.ts
index 3c6adbe5e..278d27a7c 100644
--- a/packages/core/src/storages/sitemap_request_list.ts
+++ b/packages/core/src/storages/sitemap_request_list.ts
@@ -256,6 +256,8 @@ export class SitemapRequestList implements IRequestList {
this.sitemapParsingProgress.pendingSitemapUrls = new Set(options.sitemapUrls);
this.events = config.getEventManager();
+
+ this.persistState = this.persistState.bind(this);
}
/**
@@ -418,7 +420,7 @@ export class SitemapRequestList implements IRequestList {
void requestList.load({ parseSitemapOptions: options.parseSitemapOptions });
if (requestList.persistenceOptions.enable) {
- requestList.events.on(EventType.PERSIST_STATE, async () => await requestList.persistState());
+ requestList.events.on(EventType.PERSIST_STATE, requestList.persistState);
}
options?.signal?.addEventListener('abort', () => {