mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-06-21 23:26:54 +08:00
fix(queue-worker): fill out time taken on failure too
This commit is contained in:
parent
8e57fdec2c
commit
4a947e385f
@ -711,6 +711,7 @@ async function processJob(job: Job & { id: string }, token: string) {
|
|||||||
teamId: job.data?.team_id ?? undefined,
|
teamId: job.data?.team_id ?? undefined,
|
||||||
});
|
});
|
||||||
logger.info(`🐂 Worker taking job ${job.id}`, { url: job.data.url });
|
logger.info(`🐂 Worker taking job ${job.id}`, { url: job.data.url });
|
||||||
|
const start = Date.now();
|
||||||
|
|
||||||
// Check if the job URL is researchhub and block it immediately
|
// Check if the job URL is researchhub and block it immediately
|
||||||
// TODO: remove this once solve the root issue
|
// TODO: remove this once solve the root issue
|
||||||
@ -737,7 +738,6 @@ async function processJob(job: Job & { id: string }, token: string) {
|
|||||||
current_step: "SCRAPING",
|
current_step: "SCRAPING",
|
||||||
current_url: "",
|
current_url: "",
|
||||||
});
|
});
|
||||||
const start = Date.now();
|
|
||||||
|
|
||||||
if (job.data.crawl_id) {
|
if (job.data.crawl_id) {
|
||||||
const sc = (await getCrawl(job.data.crawl_id)) as StoredCrawl;
|
const sc = (await getCrawl(job.data.crawl_id)) as StoredCrawl;
|
||||||
@ -1041,6 +1041,9 @@ async function processJob(job: Job & { id: string }, token: string) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const end = Date.now();
|
||||||
|
const timeTakenInSeconds = (end - start) / 1000;
|
||||||
|
|
||||||
logger.debug("Logging job to DB...");
|
logger.debug("Logging job to DB...");
|
||||||
await logJob(
|
await logJob(
|
||||||
{
|
{
|
||||||
@ -1053,7 +1056,7 @@ async function processJob(job: Job & { id: string }, token: string) {
|
|||||||
"Something went wrong... Contact help@mendable.ai"),
|
"Something went wrong... Contact help@mendable.ai"),
|
||||||
num_docs: 0,
|
num_docs: 0,
|
||||||
docs: [],
|
docs: [],
|
||||||
time_taken: 0,
|
time_taken: timeTakenInSeconds,
|
||||||
team_id: job.data.team_id,
|
team_id: job.data.team_id,
|
||||||
mode: job.data.mode,
|
mode: job.data.mode,
|
||||||
url: job.data.url,
|
url: job.data.url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user