MCPcopy
hub / github.com/MagicStack/asyncpg / _reset

Method _reset

asyncpg/connection.py:1527–1542  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1525 self._cleanup()
1526
1527 async def _reset(self):
1528 self._check_open()
1529 self._listeners.clear()
1530 self._log_listeners.clear()
1531
1532 if self._protocol.is_in_transaction() or self._top_xact is not None:
1533 if self._top_xact is None or not self._top_xact._managed:
1534 # Managed transactions are guaranteed to __aexit__
1535 # correctly.
1536 self._loop.call_exception_handler({
1537 'message': 'Resetting connection with an '
1538 'active transaction {!r}'.format(self)
1539 })
1540
1541 self._top_xact = None
1542 await self.execute("ROLLBACK")
1543
1544 async def reset(self, *, timeout=None):
1545 """Reset the connection state.

Callers 2

resetMethod · 0.95
releaseMethod · 0.80

Calls 4

_check_openMethod · 0.95
executeMethod · 0.95
clearMethod · 0.80
is_in_transactionMethod · 0.80

Tested by

no test coverage detected