diff --git a/README.md b/README.md index 411b515..3540cfc 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ LOG_HTML | false | Only for debugging. If `true` all HTML that passes through th CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section. TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. +BROWSER_TIMEOUT | 30000 | If you are experiencing errors/timeouts because your system is slow, you can try to increase this value. Remember to increase the `maxTimeout` parameter too. PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. diff --git a/src/services/sessions.ts b/src/services/sessions.ts index cc1f43e..75bc20f 100644 --- a/src/services/sessions.ts +++ b/src/services/sessions.ts @@ -47,7 +47,10 @@ function buildExtraPrefsFirefox(proxy: Proxy): object { "startup.homepage_welcome_url.additional": "", // Disable images to speed up load - "permissions.default.image": 2 + "permissions.default.image": 2, + + // Limit content processes to 1 + "dom.ipc.processCount": 1 } // proxy.url format => http://: @@ -116,6 +119,7 @@ export async function create(session: string, options: SessionCreateOptions): Pr const puppeteerOptions: any = { product: 'firefox', headless: process.env.HEADLESS !== 'false', + timeout: process.env.BROWSER_TIMEOUT || 30000 } puppeteerOptions.extraPrefsFirefox = buildExtraPrefsFirefox(options.proxy)