diff --git a/databases/backends/postgres.py b/databases/backends/postgres.py index 117a9464..8a1ead6d 100644 --- a/databases/backends/postgres.py +++ b/databases/backends/postgres.py @@ -1,3 +1,4 @@ +import asyncio import logging import typing from collections.abc import Mapping @@ -65,7 +66,7 @@ async def connect(self) -> None: async def disconnect(self) -> None: assert self._pool is not None, "DatabaseBackend is not running" - await self._pool.close() + await asyncio.wait_for(self._pool.close(), timeout=30) self._pool = None def connection(self) -> "PostgresConnection":