fix: move to completed in one place

This commit is contained in:
Gergo Moricz
2024-08-07 18:49:22 +02:00
parent 457c082ba1
commit 191dfbd9ca
2 changed files with 16 additions and 16 deletions
+15 -15
View File
@@ -141,21 +141,21 @@ const saveJob = async (job: Job, result: any, token: string, mode: string) => {
.eq("job_id", job.id); .eq("job_id", job.id);
if (error) throw new Error(error.message); if (error) throw new Error(error.message);
try { // try {
if (mode === "crawl") { // if (mode === "crawl") {
await job.moveToCompleted(null, token, false); // await job.moveToCompleted(null, token, false);
} else { // } else {
await job.moveToCompleted(result, token, false); // await job.moveToCompleted(result, token, false);
} // }
} catch (error) { // } catch (error) {
// I think the job won't exist here anymore // // I think the job won't exist here anymore
} // }
} else { // } else {
try { // try {
await job.moveToCompleted(result, token, false); // await job.moveToCompleted(result, token, false);
} catch (error) { // } catch (error) {
// I think the job won't exist here anymore // // I think the job won't exist here anymore
} // }
} }
ScrapeEvents.logJobEvent(job, "completed"); ScrapeEvents.logJobEvent(job, "completed");
} catch (error) { } catch (error) {