mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
added failed and completed log events
This commit is contained in:
parent
60c74357df
commit
cc98f83fda
|
@ -25,7 +25,7 @@ export type ScrapeScrapeEvent = {
|
||||||
|
|
||||||
export type ScrapeQueueEvent = {
|
export type ScrapeQueueEvent = {
|
||||||
type: "queue",
|
type: "queue",
|
||||||
event: "waiting" | "active" | "completed" | "paused" | "resumed" | "removed",
|
event: "waiting" | "active" | "completed" | "paused" | "resumed" | "removed" | "failed",
|
||||||
worker?: string,
|
worker?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { billTeam } from "../services/billing/credit_billing";
|
||||||
import { Document } from "../lib/entities";
|
import { Document } from "../lib/entities";
|
||||||
import { supabase_service } from "../services/supabase";
|
import { supabase_service } from "../services/supabase";
|
||||||
import { Logger } from "../lib/logger";
|
import { Logger } from "../lib/logger";
|
||||||
|
import { ScrapeEvents } from "../lib/scrape-events";
|
||||||
|
|
||||||
export async function startWebScraperPipeline({
|
export async function startWebScraperPipeline({
|
||||||
job,
|
job,
|
||||||
|
@ -39,6 +40,7 @@ export async function startWebScraperPipeline({
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
Logger.error(`🐂 Job failed ${job.id}`);
|
Logger.error(`🐂 Job failed ${job.id}`);
|
||||||
|
ScrapeEvents.logJobEvent(job, "failed");
|
||||||
job.moveToFailed(error);
|
job.moveToFailed(error);
|
||||||
},
|
},
|
||||||
team_id: job.data.team_id,
|
team_id: job.data.team_id,
|
||||||
|
@ -140,6 +142,7 @@ const saveJob = async (job: Job, result: any) => {
|
||||||
// I think the job won't exist here anymore
|
// I think the job won't exist here anymore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ScrapeEvents.logJobEvent(job, "completed");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(`🐂 Failed to update job status: ${error}`);
|
Logger.error(`🐂 Failed to update job status: ${error}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user