From 9cf661cc22d90decbcfb4e0041ca6c13b7608438 Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 17 Jun 2026 16:46:42 +0000 Subject: [PATCH] Wrap routine document upsert in transaction Co-Authored-By: Paperclip --- server/src/services/routines.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/services/routines.ts b/server/src/services/routines.ts index f0147197def..9ad737f3c51 100644 --- a/server/src/services/routines.ts +++ b/server/src/services/routines.ts @@ -654,6 +654,12 @@ export function routineService( actor: Actor, options: { changeSummary?: string | null } = {}, ): Promise { + if (executor === db) { + return db.transaction(async (tx) => ( + upsertRoutineDescriptionDocument(tx as unknown as Db, routine, actor, options) + )); + } + const now = new Date(); const body = routine.description ?? ""; const existing = await getRoutineDescriptionDocument(routine.id, executor);