Skip to content

Commit

Permalink
Update queue-worker.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
nickscamara committed Apr 21, 2024
1 parent 9b31e68 commit d2f808a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/api/src/services/queue-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getWebScraperQueue().process(
current_url: "",
});
const start = Date.now();

const { success, message, docs } = await startWebScraperPipeline({ job });
const end = Date.now();
const timeTakenInSeconds = (end - start) / 1000;
Expand Down Expand Up @@ -74,6 +74,19 @@ getWebScraperQueue().process(
"Something went wrong... Contact [email protected] or try again." /* etc... */,
};
await callWebhook(job.data.team_id, data);
await logJob({
success: false,
message: typeof error === 'string' ? error : (error.message ?? "Something went wrong... Contact [email protected]"),
num_docs: 0,
docs: [],
time_taken: 0,
team_id: job.data.team_id,
mode: "crawl",
url: job.data.url,
crawlerOptions: job.data.crawlerOptions,
pageOptions: job.data.pageOptions,
origin: job.data.origin,
});
done(null, data);
}
}
Expand Down

0 comments on commit d2f808a

Please sign in to comment.