diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-11-09 14:00:27 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-11-09 14:00:27 +0000 |
| commit | f8bed574ae11a29c9c59f7d96721805188a507db (patch) | |
| tree | 1f897f80976c1264eb78d42b7aa9b912379b38a8 /apps/workers/openaiWorker.ts | |
| parent | 10070c1752b5efcbfdf351454de06fbbbe9fb0b6 (diff) | |
| download | karakeep-f8bed574ae11a29c9c59f7d96721805188a507db.tar.zst | |
fix: Only update bookmark tagging/crawling status when worker is out of retries
Diffstat (limited to 'apps/workers/openaiWorker.ts')
| -rw-r--r-- | apps/workers/openaiWorker.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/workers/openaiWorker.ts b/apps/workers/openaiWorker.ts index 571d5b73..948e92a7 100644 --- a/apps/workers/openaiWorker.ts +++ b/apps/workers/openaiWorker.ts @@ -68,16 +68,18 @@ export class OpenAiWorker { { run: runOpenAI, onComplete: async (job) => { - const jobId = job?.id ?? "unknown"; + const jobId = job.id; logger.info(`[inference][${jobId}] Completed successfully`); - await attemptMarkTaggingStatus(job?.data, "success"); + await attemptMarkTaggingStatus(job.data, "success"); }, onError: async (job) => { - const jobId = job?.id ?? "unknown"; + const jobId = job.id; logger.error( `[inference][${jobId}] inference job failed: ${job.error}\n${job.error.stack}`, ); - await attemptMarkTaggingStatus(job?.data, "failure"); + if (job.numRetriesLeft == 0) { + await attemptMarkTaggingStatus(job?.data, "failure"); + } }, }, { @@ -387,7 +389,7 @@ async function connectTags( } async function runOpenAI(job: DequeuedJob<ZOpenAIRequest>) { - const jobId = job.id ?? "unknown"; + const jobId = job.id; const inferenceClient = InferenceClientFactory.build(); if (!inferenceClient) { |
