From 161d17d85b99af48a765f4536b2a7178a5fc7d96 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 24 Aug 2023 16:29:21 +0200 Subject: [PATCH] use backwards-compatible asyncio timeout implementation --- nominatim/api/connection.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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: -- 2.39.5