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

Method _cleanup

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

Source from the content-addressed store, hash-verified

1601 self._protocol = None
1602
1603 def _cleanup(self):
1604 self._call_termination_listeners()
1605 # Free the resources associated with this connection.
1606 # This must be called when a connection is terminated.
1607
1608 if self._pool_holder is not None:
1609 # Idle connections have no proxy, but still belong to a holder.
1610 holder, self._pool_holder = self._pool_holder(), None
1611 if holder is not None and holder._con is self:
1612 holder._release_on_close()
1613
1614 self._mark_stmts_as_closed()
1615 self._listeners.clear()
1616 self._log_listeners.clear()
1617 self._query_loggers.clear()
1618 self._clean_tasks()
1619
1620 def _clean_tasks(self):
1621 # Wrap-up any remaining tasks associated with this connection.

Callers 2

closeMethod · 0.95
terminateMethod · 0.95

Calls 5

_mark_stmts_as_closedMethod · 0.95
_clean_tasksMethod · 0.95
_release_on_closeMethod · 0.80
clearMethod · 0.80

Tested by

no test coverage detected