From 7f6e850b22b5b54a3a3aba3623edfd542e9951e0 Mon Sep 17 00:00:00 2001 From: casulit Date: Fri, 25 Oct 2024 09:43:53 +0800 Subject: [PATCH] refactor(config): Ensure transaction wraps property updates in deno-kv --- config/deno-kv.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/deno-kv.ts b/config/deno-kv.ts index 604f3b1..3bec40a 100644 --- a/config/deno-kv.ts +++ b/config/deno-kv.ts @@ -496,10 +496,12 @@ export async function listenQueue(kv: Deno.Kv) { // Update all processed properties in transaction for (const prop of processedProperty) { + await transaction.begin(); await transaction.queryObject({ args: [prop.ai_generated_description, prop.id], text: `UPDATE Property SET ai_generated_description = $1 WHERE id = $2`, }); + await transaction.commit(); } }