From 078c0679aa8d521c00ffa81a1a2e668697ee6d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Fri, 17 Jan 2025 17:18:36 +0100 Subject: [PATCH] fix(crawl-status): improve finished checking --- apps/api/src/controllers/v1/crawl-status.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/controllers/v1/crawl-status.ts b/apps/api/src/controllers/v1/crawl-status.ts index 02046364..694b3dca 100644 --- a/apps/api/src/controllers/v1/crawl-status.ts +++ b/apps/api/src/controllers/v1/crawl-status.ts @@ -13,6 +13,7 @@ import { getDoneJobsOrderedLength, getThrottledJobs, isCrawlFinished, + isCrawlFinishedLocked, } from "../../lib/crawl-redis"; import { getScrapeQueue } from "../../services/queue-service"; import { @@ -117,7 +118,7 @@ export async function crawlStatusController( sc.cancelled ? "cancelled" : validJobStatuses.every((x) => x[1] === "completed") && - await isCrawlFinished(req.params.jobId) + (await isCrawlFinishedLocked(req.params.jobId) || await isCrawlFinished(req.params.jobId)) ? "completed" : "scraping";