mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
use backwards-compatible asyncio timeout implementation
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user