mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 17:29:04 +08:00
fix(scrapeURL/fire-engine): timeout calculation issues
This commit is contained in:
parent
7f57c868be
commit
47b968fede
@ -123,8 +123,13 @@ export async function scrapeURLWithFireEngineChromeCDP(
|
||||
// Include specified actions
|
||||
...(meta.options.actions ?? []),
|
||||
];
|
||||
|
||||
const totalWait = actions.reduce(
|
||||
(a, x) => (x.type === "wait" ? (x.milliseconds ?? 1000) + a : a),
|
||||
0,
|
||||
);
|
||||
|
||||
const timeout = timeToRun ?? 300000;
|
||||
const timeout = (timeToRun ?? 300000) + totalWait;
|
||||
|
||||
const request: FireEngineScrapeRequestCommon &
|
||||
FireEngineScrapeRequestChromeCDP = {
|
||||
@ -146,18 +151,13 @@ export async function scrapeURLWithFireEngineChromeCDP(
|
||||
// TODO: scrollXPaths
|
||||
};
|
||||
|
||||
const totalWait = actions.reduce(
|
||||
(a, x) => (x.type === "wait" ? (x.milliseconds ?? 1000) + a : a),
|
||||
0,
|
||||
);
|
||||
|
||||
let response = await performFireEngineScrape(
|
||||
meta.logger.child({
|
||||
method: "scrapeURLWithFireEngineChromeCDP/callFireEngine",
|
||||
request,
|
||||
}),
|
||||
request,
|
||||
timeout + totalWait,
|
||||
timeout,
|
||||
);
|
||||
|
||||
specialtyScrapeCheck(
|
||||
@ -213,7 +213,8 @@ export async function scrapeURLWithFireEnginePlaywright(
|
||||
meta: Meta,
|
||||
timeToRun: number | undefined,
|
||||
): Promise<EngineScrapeResult> {
|
||||
const timeout = timeToRun ?? 300000;
|
||||
const totalWait = meta.options.waitFor;
|
||||
const timeout = (timeToRun ?? 300000) + totalWait;
|
||||
|
||||
const request: FireEngineScrapeRequestCommon &
|
||||
FireEngineScrapeRequestPlaywright = {
|
||||
@ -237,7 +238,7 @@ export async function scrapeURLWithFireEnginePlaywright(
|
||||
request,
|
||||
}),
|
||||
request,
|
||||
timeout + meta.options.waitFor,
|
||||
timeout,
|
||||
);
|
||||
|
||||
specialtyScrapeCheck(
|
||||
|
Loading…
x
Reference in New Issue
Block a user