From 7369b353244b65833c73224317b55046485f6fa9 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 09:58:41 -0700 Subject: [PATCH] =?UTF-8?q?perf(install):=20run=20connectivity=20probes=20?= =?UTF-8?q?in=20parallel=20=E2=80=94=20blocked-network=20worst=20case=2016?= =?UTF-8?q?s=20->=208s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install.sh probed pypi.org and duckduckgo.com serially with --max-time 8 each, so a fully blocked network cost 16s before the user saw any useful guidance. The two probes are independent; running them as background jobs and gathering verdicts caps the worst case at one --max-time (8s) while the good path stays instant. Verified live: reachable URLs 0.24s (both probes concurrent); blackholed 10.255.255.x URLs 8.02s total (was 2x8s), warning text unchanged. bash -n clean. --- scripts/install.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 3303f7c78fb5e..119e99dc2298d 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -949,12 +949,33 @@ check_network_prerequisites() { return 0 fi + # Run the probes in parallel — serially, two blocked probes cost + # 2 × --max-time (16 s) before the user sees any useful error; in + # parallel the worst case is one --max-time (8 s). + local pids=() + local tmpdir + tmpdir=$(mktemp -d) + local i=0 for url in "${checks[@]}"; do - if ! curl -fsSI --max-time 8 "$url" >/dev/null 2>&1; then + ( + if curl -fsSI --max-time 8 "$url" >/dev/null 2>&1; then + : > "$tmpdir/ok_$i" + fi + ) & + pids+=($!) + i=$((i + 1)) + done + wait "${pids[@]}" 2>/dev/null + + i=0 + for url in "${checks[@]}"; do + if [ ! -e "$tmpdir/ok_$i" ]; then failed=true log_warn "Could not reach $url" fi + i=$((i + 1)) done + rm -rf "$tmpdir" if [ "$failed" = false ]; then log_success "Internet connectivity looks good"