MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / _deactivate_inactive_connection

Method _deactivate_inactive_connection

asyncpg/pool.py:290–302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

288 self._inactive_callback = None
289
290 def _deactivate_inactive_connection(self) -> None:
291 if self._in_use is not None:
292 raise exceptions.InternalClientError(
293 'attempting to deactivate an acquired connection')
294
295 if self._con is not None:
296 # The connection is idle and not in use, so it's fine to
297 # use terminate() instead of close().
298 self._con.terminate()
299 # Must call clear_connection, because _deactivate_connection
300 # is called when the connection is *not* checked out, and
301 # so terminate() above will not call the below.
302 self._release_on_close()
303
304 def _release_on_close(self) -> None:
305 self._maybe_cancel_inactive_callback()

Callers

nothing calls this directly

Calls 2

_release_on_closeMethod · 0.95
terminateMethod · 0.45

Tested by

no test coverage detected