feat(api): add BROWSER_CONTENT_PROCESSES env var

This commit is contained in:
germondai
2026-07-06 20:09:30 +02:00
parent a307fe835d
commit da8f9261e1
+5
View File
@@ -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()