Skip to content

The agent that grows with you

perf(install): run connectivity probes in parallel — blocked-network worst case 16s -> 8s

teknium10c1a872af725
diff --git a/scripts/install.sh b/scripts/install.sh
index 3303f7c78fb..119e99dc229 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"