mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 05:25:53 +08:00
fix: timeout parameter
This commit is contained in:
parent
61ff011c13
commit
efe7a61e3b
@ -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}`,
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user