MCPcopy
hub / github.com/psycopg/psycopg / putconn

Method putconn

psycopg_pool/psycopg_pool/pool_async.py:357–370  ·  view source on GitHub ↗

Return a connection to the loving hands of its pool. Use this function only paired with a `getconn()`. You don't need to use it if you use the much more comfortable `connection()` context manager.

(self, conn: ACT)

Source from the content-addressed store, hash-verified

355 self.run_task(AddConnection(self, growing=True))
356
357 async def putconn(self, conn: ACT) -> None:
358 """Return a connection to the loving hands of its pool.
359
360 Use this function only paired with a `getconn()`. You don't need to use
361 it if you use the much more comfortable `connection()` context manager.
362 """
363 # Quick check to discard the wrong connection
364 self._check_pool_putconn(conn)
365
366 logger.info("returning connection to %r", self.name)
367 if await self._maybe_close_connection(conn):
368 return
369
370 await self._putconn(conn, from_getconn=False)
371
372 async def drain(self) -> None:
373 """

Callers 1

connectionMethod · 0.95

Calls 4

_putconnMethod · 0.95
_check_pool_putconnMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected