fix: forward per-request timeout to geo lookups on an injected session
_get_json applied the timeout only when it created the session; when the caller passed their own session=, the timeout was silently dropped and the session default (aiohttp's 300s) governed. the per-request timeout is now passed to session.get(timeout=...) on both the owned and injected paths. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
parent
de6911fb05
commit
83a156fd31
@ -80,7 +80,8 @@ async def _get_json(
|
||||
if owns:
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=timeout))
|
||||
try:
|
||||
async with session.get(url, headers=headers) as resp:
|
||||
request_timeout = aiohttp.ClientTimeout(total=timeout)
|
||||
async with session.get(url, headers=headers, timeout=request_timeout) as resp:
|
||||
if resp.status != 200:
|
||||
log.warning("address lookup %s -> %s", url, resp.status)
|
||||
return None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user