perf: flatten DoH tasks for concurrent gathering

Modified `collect_dns_advanced` to gather DoH probes simultaneously by building a single list of tasks, replacing the sequential gathering loop. Added a similar concurrent optimization to `system_probes` fetching.

Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot] 2026-08-19 11:27:50 +00:00 • committed by Andrew Pimenov
parent 3ab957fd0e
commit 8b0bdb4b54

View file

@ -141,14 +141,13 @@ async def collect_dns_advanced(
bogus_probe_name: str, bogus_probe_name: str,
timeout: float, timeout: float,
) -> DnsAdvanced: ) -> DnsAdvanced:
system_probes = [await resolve_system(name, timeout) for name in control_names] system_probes = list(await asyncio.gather(*(resolve_system(name, timeout) for name in control_names)))
doh_probes: list[ResolverProbe] = [] doh_tasks = [
for name in control_names: resolve_doh(client, ep.name, ep.url, name, timeout)
doh_probes.extend( for name in control_names
await asyncio.gather( for ep in doh_endpoints
*(resolve_doh(client, ep.name, ep.url, name, timeout) for ep in doh_endpoints) ]
) doh_probes = list(await asyncio.gather(*doh_tasks))
)
divergences: list[str] = [] divergences: list[str] = []
for system_probe in system_probes: for system_probe in system_probes: