mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-06-21 22:01:59 +08:00
fix: status
This commit is contained in:
parent
513f61a2d1
commit
6637dce626
@ -12,8 +12,7 @@ import {
|
||||
getDoneJobsOrdered,
|
||||
getDoneJobsOrderedLength,
|
||||
getThrottledJobs,
|
||||
isCrawlFinished,
|
||||
isCrawlFinishedLocked,
|
||||
isCrawlKickoffFinished,
|
||||
} from "../../lib/crawl-redis";
|
||||
import { getScrapeQueue } from "../../services/queue-service";
|
||||
import {
|
||||
@ -117,8 +116,7 @@ export async function crawlStatusController(
|
||||
const status: Exclude<CrawlStatusResponse, ErrorResponse>["status"] =
|
||||
sc.cancelled
|
||||
? "cancelled"
|
||||
: validJobStatuses.every((x) => x[1] === "completed") &&
|
||||
(await isCrawlFinishedLocked(req.params.jobId) || await isCrawlFinished(req.params.jobId))
|
||||
: validJobStatuses.every((x) => x[1] === "completed") && (sc.crawlerOptions ? await isCrawlKickoffFinished(req.params.jobId) : true)
|
||||
? "completed"
|
||||
: "scraping";
|
||||
|
||||
|
@ -132,6 +132,10 @@ export async function isCrawlFinished(id: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function isCrawlKickoffFinished(id: string) {
|
||||
return await redisConnection.get("crawl:" + id + ":kickoff:finish") !== null
|
||||
}
|
||||
|
||||
export async function isCrawlFinishedLocked(id: string) {
|
||||
return await redisConnection.exists("crawl:" + id + ":finish");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user