mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-05 10:20:42 +08:00
fix(crawl-status): missing partial data after cancel
This commit is contained in:
parent
810b98ec38
commit
06751a8e21
@ -23,14 +23,6 @@ export async function crawlStatusController(req: Request, res: Response) {
|
|||||||
|
|
||||||
const isCancelled = await (await getWebScraperQueue().client).exists("cancelled:" + req.params.jobId);
|
const isCancelled = await (await getWebScraperQueue().client).exists("cancelled:" + req.params.jobId);
|
||||||
|
|
||||||
if (isCancelled) {
|
|
||||||
return res.json({
|
|
||||||
status: "failed",
|
|
||||||
data: null,
|
|
||||||
partial_data: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let progress = job.progress;
|
let progress = job.progress;
|
||||||
if(typeof progress !== 'object') {
|
if(typeof progress !== 'object') {
|
||||||
progress = {
|
progress = {
|
||||||
@ -61,14 +53,14 @@ export async function crawlStatusController(req: Request, res: Response) {
|
|||||||
const jobStatus = await job.getState();
|
const jobStatus = await job.getState();
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
status: jobStatus,
|
status: isCancelled ? "failed" : jobStatus,
|
||||||
// progress: job.progress(),
|
// progress: job.progress(),
|
||||||
current,
|
current,
|
||||||
current_url,
|
current_url,
|
||||||
current_step,
|
current_step,
|
||||||
total,
|
total,
|
||||||
data: data ? data : null,
|
data: data && !isCancelled ? data : null,
|
||||||
partial_data: jobStatus == 'completed' ? [] : partialDocs,
|
partial_data: jobStatus == 'completed' && !isCancelled ? [] : partialDocs,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error);
|
Logger.error(error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user