Skip to content

Commit

Permalink
fix: don't call notify in addRequests() (#2425)
Browse files Browse the repository at this point in the history
Reverting the `notify` call in `addRequests` because of the call stack
issues (#2421 )
  • Loading branch information
barjin authored Apr 17, 2024
1 parent 635f046 commit c4d5446
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/basic-crawler/src/internals/basic-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,14 +950,7 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
*/
async addRequests(requests: (string | Source)[], options: CrawlerAddRequestsOptions = {}): Promise<CrawlerAddRequestsResult> {
const requestQueue = await this.getRequestQueue();
const res = await requestQueue.addRequestsBatched(requests, options);

// Notify AutoscaledPool, if it exists, the method is called after the crawler started, and we don't want to wait
// this is important for crawlers in `keepAlive` mode that might have an empty queue and we don't want to wait till
// the next scheduled check (which might come in as much as 500ms by default).
await this.autoscaledPool?.notify();

return res;
return requestQueue.addRequestsBatched(requests, options);
}

/**
Expand Down

0 comments on commit c4d5446

Please sign in to comment.