From 2d3d7c827a75a211105e95bbdae810349b38cdf4 Mon Sep 17 00:00:00 2001 From: rafaelsideguide <150964962+rafaelsideguide@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:40:29 -0300 Subject: [PATCH] fix/added unkwown status to job filter --- apps/api/src/controllers/v0/crawl-status.ts | 2 +- apps/api/src/controllers/v1/crawl-status-ws.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/controllers/v0/crawl-status.ts b/apps/api/src/controllers/v0/crawl-status.ts index 4c50b375..66522bcf 100644 --- a/apps/api/src/controllers/v0/crawl-status.ts +++ b/apps/api/src/controllers/v0/crawl-status.ts @@ -60,7 +60,7 @@ export async function crawlStatusController(req: Request, res: Response) { })); // Filter out failed jobs - jobsWithStatuses = jobsWithStatuses.filter(x => x.status !== "failed"); + jobsWithStatuses = jobsWithStatuses.filter(x => x.status !== "failed" && x.status !== "unknown"); // Sort jobs by timestamp jobsWithStatuses.sort((a, b) => a.job.timestamp - b.job.timestamp); diff --git a/apps/api/src/controllers/v1/crawl-status-ws.ts b/apps/api/src/controllers/v1/crawl-status-ws.ts index b67e559b..0d6d5803 100644 --- a/apps/api/src/controllers/v1/crawl-status-ws.ts +++ b/apps/api/src/controllers/v1/crawl-status-ws.ts @@ -101,7 +101,7 @@ async function crawlStatusWS(ws: WebSocket, req: RequestWithAuth !jobStatuses.some(status => status[0] === id && status[1] === "failed")); // filter the job statues - jobStatuses = jobStatuses.filter(x => x[1] !== "failed"); + jobStatuses = jobStatuses.filter(x => x[1] !== "failed" && x[1] !== "unknown"); const status: Exclude["status"] = sc.cancelled ? "cancelled" : jobStatuses.every(x => x[1] === "completed") ? "completed" : "scraping"; const doneJobs = await getJobs(doneJobIDs); const data = doneJobs.map(x => x.returnvalue);