Update index.ts

This commit is contained in:
Nicolas 2024-12-15 14:36:09 -03:00
parent 98f27b0acc
commit a5256827c0

View File

@ -51,7 +51,11 @@ async function performFireEngineScrape<
}); });
} }
if (Date.now() - startTime > timeout) { const userParam = request.timeout ?? 0;
// Use 70% of the user-provided timeout as the timeout for fire-engine check status
const fireEngineTimeout = timeout + Math.round(userParam * 0.7);
const fullTimeout = Math.max(fireEngineTimeout, timeout);
if (Date.now() - startTime > fullTimeout) {
logger.info( logger.info(
"Fire-engine was unable to scrape the page before timing out.", "Fire-engine was unable to scrape the page before timing out.",
{ errors, timeout }, { errors, timeout },