X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/06a974df365d19b92c49e64d9c97b5c9c7867919..e0ca2ce6ecfca1e5fae1131c09c759cc3be2d1b2:/nominatim/api/connection.py diff --git a/nominatim/api/connection.py b/nominatim/api/connection.py index f124b189..405213e9 100644 --- a/nominatim/api/connection.py +++ b/nominatim/api/connection.py @@ -51,8 +51,7 @@ class SearchConnection: """ Execute a 'scalar()' query on the connection. """ log().sql(self.connection, sql, params) - async with asyncio.timeout(self.query_timeout): - return await self.connection.scalar(sql, params) + return await asyncio.wait_for(self.connection.scalar(sql, params), self.query_timeout) async def execute(self, sql: 'sa.Executable', @@ -61,8 +60,7 @@ class SearchConnection: """ Execute a 'execute()' query on the connection. """ log().sql(self.connection, sql, params) - async with asyncio.timeout(self.query_timeout): - return await self.connection.execute(sql, params) + return await asyncio.wait_for(self.connection.execute(sql, params), self.query_timeout) async def get_property(self, name: str, cached: bool = True) -> str: