mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: rollback should await a result (#7712)
This commit is contained in:
parent
49fecb2005
commit
a4c49e7d7f
@ -93,10 +93,11 @@ export function withRollback<S>(
|
||||
const service = serviceFactory(db) as WithRollback<S>;
|
||||
|
||||
service.rollback = async <R>(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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user