perf(install): run connectivity probes in parallel — blocked-network worst case 16s -> 8s
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.
This commit is contained in:
parent
3334db67a4
commit
7369b35324
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue