From 5682175fcc82b6cbbf2878a7e134c7ad6ee142e7 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Tue, 11 Jul 2023 12:58:20 +0100 Subject: [PATCH] feat: added analyser timeout configuration (env var) Fixes #360 --- packages/ace-axe-runner-electron/src/init.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/ace-axe-runner-electron/src/init.js b/packages/ace-axe-runner-electron/src/init.js index 4a3e9f2c..3e2f0e67 100644 --- a/packages/ace-axe-runner-electron/src/init.js +++ b/packages/ace-axe-runner-electron/src/init.js @@ -229,8 +229,21 @@ function loadUrl(browserWindow) { return; } - const MILLISECONDS_TIMEOUT_INITIAL = 10000; // 10s max to load the window's web contents - const MILLISECONDS_TIMEOUT_EXTENSION = 480000; // 480s (8mn) max to load + execute Axe checkers + let _MILLISECONDS_TIMEOUT_INITIAL = 0; + try { + _MILLISECONDS_TIMEOUT_INITIAL = process.env.ACE_TIMEOUT_INITIAL ? parseInt(process.env.ACE_TIMEOUT_INITIAL, 10) : 0; + } catch(_e) { + // ignore + } + let _MILLISECONDS_TIMEOUT_EXTENSION = 0; + try { + _MILLISECONDS_TIMEOUT_EXTENSION = process.env.ACE_TIMEOUT_EXTENSION ? parseInt(process.env.ACE_TIMEOUT_EXTENSION, 10) : 0; + } catch(_e) { + // ignore + } + const MILLISECONDS_TIMEOUT_INITIAL = _MILLISECONDS_TIMEOUT_INITIAL || 10000; // 10s max to load the window's web contents + const MILLISECONDS_TIMEOUT_EXTENSION = _MILLISECONDS_TIMEOUT_EXTENSION || 480000; // 480s (8mn) max to load + execute Axe checkers + const timeoutFunc = () => { if (browserWindow.ace__replySent) { browserWindow.ace__timeout = undefined;