From da8f9261e1e6a1994b65391946fcca49a62d8732 Mon Sep 17 00:00:00 2001 From: germondai Date: Mon, 6 Jul 2026 20:09:30 +0200 Subject: [PATCH] feat(api): add BROWSER_CONTENT_PROCESSES env var --- apps/api/src/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index cb5647c..8a5ec65 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -22,6 +22,10 @@ const POOL_SIZE = Number(process.env.BROWSER_POOL_SIZE ?? "3") const ACQUIRE_TIMEOUT_MS = Number(process.env.BROWSER_ACQUIRE_TIMEOUT_MS ?? "15000") const SESSION_TTL = Number(process.env.SESSION_TTL_SECONDS ?? "3600") const RECYCLE_AFTER_TEMPORARY_CONTEXTS = Number(process.env.BROWSER_RECYCLE_AFTER_CONTEXTS ?? "8") +// Caps Firefox content processes per browser. Default `2` keeps thread/RAM footprint +// minimal while still allowing CF/Imperva challenges to resolve. Raise if specific +// targets fail with empty content (rare). +const CONTENT_PROCESSES = Number(process.env.BROWSER_CONTENT_PROCESSES ?? "2") // PROXY_URL / RESIDENTIAL_PROXY_URL accept a comma-separated list of proxy URLs (a single // URL still works — it's just a 1-element list). *_LIST_FILE is an alternative source @@ -55,6 +59,7 @@ async function initPool() { poolSize: POOL_SIZE, acquireTimeoutMs: ACQUIRE_TIMEOUT_MS, recycleAfterTemporaryContexts: RECYCLE_AFTER_TEMPORARY_CONTEXTS, + contentProcesses: CONTENT_PROCESSES, }) await pool.init() pool.startHealthCheck()