Skip to content

Commit 8514a46

Browse files
committed
postgres: use wait_for in disconnect
This is recommended by asyncpg [1]. 1: https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/pool.py#L655-L656
1 parent c008b2a commit 8514a46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

databases/backends/postgres.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
import typing
34
from collections.abc import Mapping
@@ -65,7 +66,7 @@ async def connect(self) -> None:
6566

6667
async def disconnect(self) -> None:
6768
assert self._pool is not None, "DatabaseBackend is not running"
68-
await self._pool.close()
69+
await asyncio.wait_for(self._pool.close(), timeout=30)
6970
self._pool = None
7071

7172
def connection(self) -> "PostgresConnection":

0 commit comments

Comments
 (0)