@@ -46,6 +46,12 @@ async function getProxyConfiguration(proxyOptions: ProxyOptions) {
4646
4747const DEFAULT_PROXY_OPTIONS = ragWebBrowserInputSchema . properties . proxyConfiguration . default as ProxyOptions ;
4848
49+ /**
50+ * How many pages the shared crawlers fetch in parallel to begin with. Set from the run's own input at
51+ * startup, never from a request: see `processInput`.
52+ */
53+ let runDesiredConcurrency = ragWebBrowserInputSchema . properties . desiredConcurrency . default ;
54+
4955/**
5056 * The configuration every crawler is built with. It resolves the proxy from the request Crawlee is
5157 * about to send rather than from the input the crawler was built with, so one crawler serves callers
@@ -92,6 +98,7 @@ async function validateProxyConfiguration(proxyOptions: ProxyOptions, abortOnFai
9298export async function processStandbyInput ( originalInput : Partial < Input > ) {
9399 const { input, searchCrawlerOptions, contentScraperSettings } = await processInputInternal ( originalInput , true ) ;
94100
101+ runDesiredConcurrency = input . desiredConcurrency ;
95102 await validateProxyConfiguration ( input . proxyConfiguration , true ) ;
96103 const contentCrawlerOptions : ContentCrawlerOptions [ ] = [
97104 createPlaywrightCrawlerOptions ( input ) ,
@@ -110,6 +117,13 @@ export async function processInput(originalInput: Partial<Input>) {
110117 // In Standby this runs once per request, where a proxy problem must fail that request alone. In
111118 // Normal mode it is the run's startup, where there is nothing to serve and the run ends.
112119 await validateProxyConfiguration ( input . proxyConfiguration , ! isActorStandby ( ) ) ;
120+
121+ // A Standby request builds these options whenever no crawler is cached yet, at boot before the
122+ // crawlers are up or after a failed one was dropped, so whichever caller got there first would
123+ // size the pool that every later caller then shares. The run sizes it instead. Nobody loses a
124+ // guarantee: the pool is sized for the instance, not per caller, and it autoscales from here.
125+ if ( isActorStandby ( ) ) input . desiredConcurrency = runDesiredConcurrency ;
126+
113127 const contentCrawlerOptions : ContentCrawlerOptions = input . scrapingTool === 'raw-http'
114128 ? createCheerioCrawlerOptions ( input , false )
115129 : createPlaywrightCrawlerOptions ( input , false ) ;
0 commit comments