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:
disqualifier 2026-06-29 01:10:25 -04:00
parent de6911fb05
commit 83a156fd31

View File

@ -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