MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / __aexit__

Method __aexit__

tortoise/backends/base/client.py:350–362  ·  view source on GitHub ↗
(self, exc_type: Any, exc_val: Any, exc_tb: Any)

Source from the content-addressed store, hash-verified

348 return self.client
349
350 async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
351 try:
352 if not self.client._finalized:
353 if exc_type:
354 # Can't rollback a transaction that already failed.
355 if exc_type is not TransactionManagementError:
356 await self.client.rollback()
357 else:
358 await self.client.commit()
359 finally:
360 if self.client._parent._pool:
361 await self.client._parent._pool.release(self.client._connection)
362 get_connections().reset(self.token)
363
364
365class NestedTransactionContext(TransactionContext):

Callers

nothing calls this directly

Calls 5

get_connectionsFunction · 0.90
releaseMethod · 0.80
resetMethod · 0.80
rollbackMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected