MCPcopy
hub / github.com/psycopg/psycopg / close

Method close

psycopg_pool/psycopg_pool/_compat.py:37–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

35 """
36
37 async def close(self) -> None:
38 if pool := getattr(self, "_pool", None):
39 # Connection currently checked out from the pool.
40 # Instead of closing it, return it to the pool.
41 await pool.putconn(self)
42 else:
43 # Connection not part of any pool, or currently into the pool.
44 # Close the connection for real.
45 await super().close()
46
47 class PoolConnection(psycopg.Connection): # type: ignore[no-redef]
48 """

Callers

nothing calls this directly

Calls 2

putconnMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected