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/crawlerWorker.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/crawlerWorker.ts')
| -rw-r--r-- | apps/workers/crawlerWorker.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/workers/crawlerWorker.ts b/apps/workers/crawlerWorker.ts index f607234e..c8141d39 100644 --- a/apps/workers/crawlerWorker.ts +++ b/apps/workers/crawlerWorker.ts @@ -166,20 +166,20 @@ export class CrawlerWorker { /* timeoutSec */ serverConfig.crawler.jobTimeoutSec, ), onComplete: async (job) => { - const jobId = job?.id ?? "unknown"; + const jobId = job.id; logger.info(`[Crawler][${jobId}] Completed successfully`); - const bookmarkId = job?.data.bookmarkId; + const bookmarkId = job.data.bookmarkId; if (bookmarkId) { await changeBookmarkStatus(bookmarkId, "success"); } }, onError: async (job) => { - const jobId = job?.id ?? "unknown"; + const jobId = job.id; logger.error( `[Crawler][${jobId}] Crawling job failed: ${job.error}\n${job.error.stack}`, ); const bookmarkId = job.data?.bookmarkId; - if (bookmarkId) { + if (bookmarkId && job.numRetriesLeft == 0) { await changeBookmarkStatus(bookmarkId, "failure"); } }, |
