aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2026-02-08 13:07:16 +0000
committerGitHub <noreply@github.com>2026-02-08 13:07:16 +0000
commit960ca9b67915408f26b825886f2b6c6481a658dc (patch)
tree2de224f2b3efaedeba3c979f1bad0ace9e658f15 /apps
parent1a01f75d35abb4aa02edee22e1e5640d3f0aa27c (diff)
downloadkarakeep-960ca9b67915408f26b825886f2b6c6481a658dc.tar.zst
fix: treat bookmark not found as a no-op in rule engine instead of a failure (#2464)
When a bookmark is deleted before the rule engine worker processes its event, the worker would throw an error, triggering failure metrics, error logging, and retries. This changes both the worker and RuleEngine.forBookmark to gracefully skip processing with an info log instead. Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/workers/workers/ruleEngineWorker.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/workers/workers/ruleEngineWorker.ts b/apps/workers/workers/ruleEngineWorker.ts
index 00e20127..ecf733cd 100644
--- a/apps/workers/workers/ruleEngineWorker.ts
+++ b/apps/workers/workers/ruleEngineWorker.ts
@@ -67,14 +67,21 @@ async function runRuleEngine(job: DequeuedJob<ZRuleEngineRequest>) {
const bookmark = await getBookmarkUserId(bookmarkId);
if (!bookmark) {
- throw new Error(
- `[ruleEngine][${jobId}] bookmark with id ${bookmarkId} was not found`,
+ logger.info(
+ `[ruleEngine][${jobId}] bookmark with id ${bookmarkId} was not found, skipping`,
);
+ return;
}
const userId = bookmark.userId;
const authedCtx = await buildImpersonatingAuthedContext(userId);
const ruleEngine = await RuleEngine.forBookmark(authedCtx, bookmarkId);
+ if (!ruleEngine) {
+ logger.info(
+ `[ruleEngine][${jobId}] bookmark with id ${bookmarkId} was not found during rule evaluation, skipping`,
+ );
+ return;
+ }
const results = (
await Promise.all(events.map((event) => ruleEngine.onEvent(event)))