Fix: Drastically reduce wait times for quick progress checks

- 250ms transfer: 1s wait (was 5-19s)
- 1 connection: +1s extra
- Formula: transfer_ms/1000 + 1s (+1s for 1 conn), min 1s
- 10MB SSD write should complete well within 1s

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
taptap
2026-06-24 17:03:46 +02:00
parent dd1f934570
commit 3c98ca5803
+5 -9
View File
@@ -236,15 +236,11 @@ run_fastsync() {
local transfer_ms=$(echo "$output" | grep -oP 'ms=\K[0-9.]+' || echo "0")
local transfer_ms_int=$(echo "$transfer_ms" | awk '{printf "%d", $1+0}')
# Wait: transfer time + latency-based margin + disk sync margin
# For 1 connection, add extra margin as it's sequential
local latency_margin=$(( LATENCY_MS * 2 ))
local sync_margin=3
local extra_for_1conn=0
[ "$nconn" -eq 1 ] && extra_for_1conn=5
local wait_time=$(( transfer_ms_int / 1000 + latency_margin / 10 + sync_margin + extra_for_1conn ))
[ "$wait_time" -lt 5 ] && wait_time=5
# Aggressive wait times for quick progress checks
# Formula: max(transfer_time/1000 + 1s, 1s) + 1s extra for 1 conn
local wait_time=$(( transfer_ms_int / 1000 + 1 ))
[ "$nconn" -eq 1 ] && wait_time=$(( wait_time + 1 ))
[ "$wait_time" -lt 1 ] && wait_time=1
sleep $wait_time
kill "$spid" 2>/dev/null || true