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.

fix: always limit `desiredConcurrency` to the value of `maxConcurrency`

Martin Adámekbcb689d4cb90
diff --git a/packages/core/src/autoscaling/autoscaled_pool.ts b/packages/core/src/autoscaling/autoscaled_pool.ts
index d1313e186..0ffcc9675 100644
--- a/packages/core/src/autoscaling/autoscaled_pool.ts
+++ b/packages/core/src/autoscaling/autoscaled_pool.ts
@@ -271,7 +271,7 @@ export class AutoscaledPool {
// Internal properties.
this._minConcurrency = minConcurrency;
this._maxConcurrency = maxConcurrency;
- this._desiredConcurrency = desiredConcurrency ?? minConcurrency;
+ this._desiredConcurrency = Math.min(desiredConcurrency ?? minConcurrency, maxConcurrency);
this._currentConcurrency = 0;
this.isStopped = false;
this.resolve = null;