From a4c49e7d7f877967cca03f12bac14ebb7aadceb3 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 31 Jul 2024 16:46:15 +0200 Subject: [PATCH] fix: rollback should await a result (#7712) --- src/lib/db/transaction.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/db/transaction.ts b/src/lib/db/transaction.ts index 0fa5905ac7..96e9546c00 100644 --- a/src/lib/db/transaction.ts +++ b/src/lib/db/transaction.ts @@ -93,10 +93,11 @@ export function withRollback( const service = serviceFactory(db) as WithRollback; service.rollback = async (fn: (service: S) => R) => { - const trx = await db.transaction({ isolationLevel: 'serializable' }); + const trx = await db.transaction(); try { const transactionService = serviceFactory(trx); - return fn(transactionService); + const result = await fn(transactionService); + return result; } finally { await trx.rollback(); }