mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-05 21:06:06 +08:00
fix: move to completed in one place
This commit is contained in:
parent
457c082ba1
commit
191dfbd9ca
@ -141,21 +141,21 @@ const saveJob = async (job: Job, result: any, token: string, mode: string) => {
|
||||
.eq("job_id", job.id);
|
||||
|
||||
if (error) throw new Error(error.message);
|
||||
try {
|
||||
if (mode === "crawl") {
|
||||
await job.moveToCompleted(null, token, false);
|
||||
} else {
|
||||
await job.moveToCompleted(result, token, false);
|
||||
}
|
||||
} catch (error) {
|
||||
// I think the job won't exist here anymore
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await job.moveToCompleted(result, token, false);
|
||||
} catch (error) {
|
||||
// I think the job won't exist here anymore
|
||||
}
|
||||
// try {
|
||||
// if (mode === "crawl") {
|
||||
// await job.moveToCompleted(null, token, false);
|
||||
// } else {
|
||||
// await job.moveToCompleted(result, token, false);
|
||||
// }
|
||||
// } catch (error) {
|
||||
// // I think the job won't exist here anymore
|
||||
// }
|
||||
// } else {
|
||||
// try {
|
||||
// await job.moveToCompleted(result, token, false);
|
||||
// } catch (error) {
|
||||
// // I think the job won't exist here anymore
|
||||
// }
|
||||
}
|
||||
ScrapeEvents.logJobEvent(job, "completed");
|
||||
} catch (error) {
|
||||
|
@ -51,7 +51,7 @@ const processJobInternal = async (token: string, job: Job) => {
|
||||
try {
|
||||
const result = await processJob(job, token);
|
||||
const jobState = await job.getState();
|
||||
if(jobState !== "completed" && jobState !== "failed"){
|
||||
if (jobState !== "completed" && jobState !== "failed") {
|
||||
try{
|
||||
await job.moveToCompleted(result.docs, token, false); //3rd arg fetchNext
|
||||
}catch(e){
|
||||
|
Loading…
x
Reference in New Issue
Block a user