Skip to content

Commit d003102

Browse files
bk86aclaude
andcommitted
fix(perf_test): run_warm picked blank lines from vegeta target file
vegeta target files have 2-line entries (GET URL\n\n), so picking by raw line number landed on a blank line half the time. The empty URL made curl exit non-zero and `set -e` killed the script before the warm pass could complete. Extract just the GET URLs into an array first, then index into that array. Caught while running scripts/perf_test.sh against the post-#68 deployment for the multi-worker re-baseline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 18e1908 commit d003102

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

scripts/perf_test.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,20 @@ PYEOF
104104

105105
run_warm() {
106106
echo "=== warm: 500 sequential mixed lookups ==="
107+
# vegeta target files have 2-line entries (GET URL\n\n), so picking by raw
108+
# line number lands on a blank line half the time → curl gets an empty URL
109+
# → set -e kills the script. Extract just the GET URLs first.
110+
local urls=()
111+
mapfile -t urls < <(awk 'NR%2==1 && /^GET / {print substr($0, 5)}' "${OUTDIR}/targets_B.txt")
112+
if [ "${#urls[@]}" -eq 0 ]; then
113+
echo "warm: no targets in ${OUTDIR}/targets_B.txt" >&2
114+
return 1
115+
fi
107116
local errors=0
108117
for _ in $(seq 1 500); do
109-
local n=$((RANDOM % 100 + 2))
110-
local line
111-
line=$(sed -n "${n}p" "${OUTDIR}/targets_B.txt")
118+
local idx=$((RANDOM % ${#urls[@]}))
112119
local code
113-
code=$(curl -s -o /dev/null -w "%{http_code}" -H "${HEADER}" "${line#GET }")
120+
code=$(curl -s -o /dev/null -w "%{http_code}" -H "${HEADER}" "${urls[$idx]}")
114121
[ "${code}" = "200" ] || errors=$((errors + 1))
115122
done
116123
echo "warm complete; errors=${errors}"

0 commit comments

Comments
 (0)