Skip to content

Commit

Permalink
fix(workers): Log stacktrace on worker error. #424 (#429)
Browse files Browse the repository at this point in the history
extended logging when an exception occurrs, so it is possible to see the stacktrace of a failed execution
  • Loading branch information
kamtschatka authored Sep 26, 2024
1 parent 4db50c2 commit 7cc2f8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/workers/crawlerWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ export class CrawlerWorker {
},
onError: async (job) => {
const jobId = job?.id ?? "unknown";
logger.error(`[Crawler][${jobId}] Crawling job failed: ${job.error}`);
logger.error(
`[Crawler][${jobId}] Crawling job failed: ${job.error}\n${job.error.stack}`,
);
const bookmarkId = job.data?.bookmarkId;
if (bookmarkId) {
await changeBookmarkStatus(bookmarkId, "failure");
Expand Down
2 changes: 1 addition & 1 deletion apps/workers/openaiWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class OpenAiWorker {
onError: async (job) => {
const jobId = job?.id ?? "unknown";
logger.error(
`[inference][${jobId}] inference job failed: ${job.error}`,
`[inference][${jobId}] inference job failed: ${job.error}\n${job.error.stack}`,
);
await attemptMarkTaggingStatus(job?.data, "failure");
},
Expand Down
4 changes: 3 additions & 1 deletion apps/workers/searchWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class SearchIndexingWorker {
},
onError: (job) => {
const jobId = job?.id ?? "unknown";
logger.error(`[search][${jobId}] search job failed: ${job.error}`);
logger.error(
`[search][${jobId}] search job failed: ${job.error}\n${job.error.stack}`,
);
return Promise.resolve();
},
},
Expand Down

0 comments on commit 7cc2f8b

Please sign in to comment.