We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
transaction
commit
1 parent 28d6546 commit e3adf71Copy full SHA for e3adf71
1 file changed
src/ttt/infrastructure/adapters/transaction.py
@@ -45,6 +45,11 @@ async def __aexit__(
45
46
async def commit(self) -> None:
47
transaction = not_none(self._session.get_transaction())
48
+
49
+ if not transaction.is_active:
50
+ await transaction.rollback()
51
+ return
52
53
with reraise_serialization_error():
54
await transaction.commit()
55
@@ -78,7 +83,11 @@ async def __aexit__(
78
83
79
84
80
85
81
- await transaction.commit()
86
87
+ if transaction.is_active:
88
+ await transaction.commit()
89
+ else:
90
82
91
92
93
@dataclass
0 commit comments