Skip to content

Commit fe7d3f0

Browse files
committed
fix: update request handler to use addRequests for search crawler
1 parent b8cacfb commit fe7d3f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/crawlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function createAndStartSearchCrawler(
7070
const crawler = new CheerioCrawler({
7171
...(searchCrawlerOptions as CheerioCrawlerOptions),
7272
requestQueue: await RequestQueue.open(key, { storageClient: client }),
73-
requestHandler: async ({ request, $: _$ }: CheerioCrawlingContext<SearchCrawlerUserData>) => {
73+
requestHandler: async ({ request, $: _$, addRequests }: CheerioCrawlingContext<SearchCrawlerUserData>) => {
7474
// NOTE: we need to cast this to fix `cheerio` type errors
7575
addTimeMeasureEvent(request.userData!, 'cheerio-request-handler-start');
7676
const $ = _$ as CheerioAPI;
@@ -108,7 +108,7 @@ export async function createAndStartSearchCrawler(
108108
searchCrawlerOptions.proxyConfiguration,
109109
nextOffset,
110110
);
111-
await crawler.requestQueue!.addRequest(nextRequest);
111+
await addRequests([nextRequest]);
112112
} else {
113113
// We have enough results or reached max pages, proceed to content crawling
114114
const finalResults = deduplicated.slice(0, request.userData.maxResults);

0 commit comments

Comments
 (0)