(self, _to_root: bool = False)
| 1324 | SessionTransactionState.CLOSED, |
| 1325 | ) |
| 1326 | def commit(self, _to_root: bool = False) -> None: |
| 1327 | if self._state is not SessionTransactionState.PREPARED: |
| 1328 | with self._expect_state(SessionTransactionState.PREPARED): |
| 1329 | self._prepare_impl() |
| 1330 | |
| 1331 | if self._parent is None or self.nested: |
| 1332 | for conn, trans, should_commit, autoclose in set( |
| 1333 | self._connections.values() |
| 1334 | ): |
| 1335 | if should_commit: |
| 1336 | trans.commit() |
| 1337 | |
| 1338 | self._state = SessionTransactionState.COMMITTED |
| 1339 | self.session.dispatch.after_commit(self.session) |
| 1340 | |
| 1341 | self._remove_snapshot() |
| 1342 | |
| 1343 | with self._expect_state(SessionTransactionState.CLOSED): |
| 1344 | self.close() |
| 1345 | |
| 1346 | if _to_root and self._parent: |
| 1347 | self._parent.commit(_to_root=True) |
| 1348 | |
| 1349 | @_StateChange.declare_states( |
| 1350 | ( |
nothing calls this directly
no test coverage detected