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

Method putconn

psycopg_pool/psycopg_pool/pool.py:319–332  ·  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: CT)

Source from the content-addressed store, hash-verified

317 self.run_task(AddConnection(self, growing=True))
318
319 def putconn(self, conn: CT) -> None:
320 """Return a connection to the loving hands of its pool.
321
322 Use this function only paired with a `getconn()`. You don't need to use
323 it if you use the much more comfortable `connection()` context manager.
324 """
325 # Quick check to discard the wrong connection
326 self._check_pool_putconn(conn)
327
328 logger.info("returning connection to %r", self.name)
329 if self._maybe_close_connection(conn):
330 return
331
332 self._putconn(conn, from_getconn=False)
333
334 def drain(self) -> None:
335 """

Callers 15

connectionMethod · 0.95
closeMethod · 0.45
closeMethod · 0.45
test_intrans_rollbackFunction · 0.45
test_inerror_rollbackFunction · 0.45
test_active_closeFunction · 0.45
test_fail_rollback_closeFunction · 0.45
test_getconn_checkFunction · 0.45
closeMethod · 0.45
test_intrans_rollbackFunction · 0.45
test_inerror_rollbackFunction · 0.45

Calls 4

_putconnMethod · 0.95
_check_pool_putconnMethod · 0.80
infoMethod · 0.45

Tested by 15

test_intrans_rollbackFunction · 0.36
test_inerror_rollbackFunction · 0.36
test_active_closeFunction · 0.36
test_fail_rollback_closeFunction · 0.36
test_getconn_checkFunction · 0.36
closeMethod · 0.36
test_intrans_rollbackFunction · 0.36
test_inerror_rollbackFunction · 0.36
test_active_closeFunction · 0.36
test_fail_rollback_closeFunction · 0.36
test_intrans_rollbackFunction · 0.36