mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-16 04:15:57 +08:00
fix: abortsignal pre-check
This commit is contained in:
parent
42c8adf9e5
commit
656c769f73
@ -1130,6 +1130,9 @@ async function processJob(job: Job & { id: string }, token: string) {
|
|||||||
logger.info(`🐂 Worker taking job ${job.id}`, { url: job.data.url });
|
logger.info(`🐂 Worker taking job ${job.id}`, { url: job.data.url });
|
||||||
const start = job.data.startTime ?? Date.now();
|
const start = job.data.startTime ?? Date.now();
|
||||||
const remainingTime = job.data.scrapeOptions.timeout ? (job.data.scrapeOptions.timeout - (Date.now() - start)) : undefined;
|
const remainingTime = job.data.scrapeOptions.timeout ? (job.data.scrapeOptions.timeout - (Date.now() - start)) : undefined;
|
||||||
|
if (remainingTime !== undefined && remainingTime < 0) {
|
||||||
|
throw new Error("timeout");
|
||||||
|
}
|
||||||
const signal = remainingTime ? AbortSignal.timeout(remainingTime) : undefined;
|
const signal = remainingTime ? AbortSignal.timeout(remainingTime) : undefined;
|
||||||
|
|
||||||
const costTracking = new CostTracking();
|
const costTracking = new CostTracking();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user