hasql
hasql copied to clipboard
Background task checking pools died
Hello! I encountered a case when the task that checks pools died.
https://github.com/aiokitchen/hasql/blob/master/hasql/base.py#L519
async def _check_pool_task(self, index: int):
try:
...
await self._periodic_pool_check(pool, dsn, sys_connection)
finally:
if sys_connection is not None:
try:
await self.release_to_pool(sys_connection, pool)
except Exception:
logger.warning(
"Release connection to pool with "
"exception for dsn=%r",
censored_dsn,
exc_info=True,
)
sys_connection = None
self.release_to_pool called asyncpg.Pool.release, that threw asyncio.CancelledError (BaseException), that is not caught anywhere.
Need to add CancelledError in addition to Exception.