MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _reset

Method _reset

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

Source from the content-addressed store, hash-verified

1548 self._cleanup()
1549
1550 async def _reset(self):
1551 self._check_open()
1552 self._listeners.clear()
1553 self._log_listeners.clear()
1554
1555 if self._protocol.is_in_transaction() or self._top_xact is not None:
1556 if self._top_xact is None or not self._top_xact._managed:
1557 # Managed transactions are guaranteed to __aexit__
1558 # correctly.
1559 self._loop.call_exception_handler({
1560 'message': 'Resetting connection with an '
1561 'active transaction {!r}'.format(self)
1562 })
1563
1564 self._top_xact = None
1565 await self.execute("ROLLBACK")
1566
1567 async def reset(self, *, timeout=None):
1568 """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