INNER CODE UNIT · Python
_close_config_listener
yihong1120/Construction-Hazard-Detection · main.py:175
async def _close_config_listener(self, pool: Pool | None = None) -> None:
"""Release the reserved LISTEN connection before closing its pool."""
connection = self._config_listener_connection
self._config_listener_connection = None
if connection is None:
return
target_pool = pool or self.db_pool
if target_pool is None:
return
with suppress(Exception):
await connection.remove_listener(
'stream_config_changed',
self._on_stream_config_changed,
)
with suppress(Exception):
await target_pool.release(connection)