diff --git a/backend/functions/src/cloud-functions/crawler.ts b/backend/functions/src/cloud-functions/crawler.ts index cce75ff..68fea0c 100644 --- a/backend/functions/src/cloud-functions/crawler.ts +++ b/backend/functions/src/cloud-functions/crawler.ts @@ -710,7 +710,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; const formatted = await this.formatSnapshot(crawlerOptions.respondWith, scrapped, urlToCrawl); chargeAmount = this.getChargeAmount(formatted); - if (crawlerOptions.timeout !== null) { + if (crawlerOptions.timeout === undefined) { return formatted; } } @@ -734,7 +734,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; const formatted = await this.formatSnapshot(crawlerOptions.respondWith, scrapped, urlToCrawl); chargeAmount = this.getChargeAmount(formatted); - if (crawlerOptions.timeout !== null) { + if (crawlerOptions.timeout === undefined) { if (crawlerOptions.respondWith === 'screenshot' && Reflect.get(formatted, 'screenshotUrl')) { return assignTransferProtocolMeta(`${formatted}`, diff --git a/backend/functions/src/dto/scrapping-options.ts b/backend/functions/src/dto/scrapping-options.ts index 0eec389..43ea49e 100644 --- a/backend/functions/src/dto/scrapping-options.ts +++ b/backend/functions/src/dto/scrapping-options.ts @@ -213,8 +213,8 @@ export class CrawlerOptions extends AutoCastable { } let timeoutSeconds = parseInt(ctx?.req.get('x-timeout') || ''); - if (!isNaN(timeoutSeconds) && timeoutSeconds > 0 && timeoutSeconds <= 180) { - instance.timeout = timeoutSeconds; + if (!isNaN(timeoutSeconds) && timeoutSeconds > 0) { + instance.timeout = timeoutSeconds <= 180 ? timeoutSeconds : 180; } else if (ctx?.req.get('x-timeout')) { instance.timeout = null; }