Compare commits

...
Sign in to create a new pull request.

2 commits

View file

@ -174,7 +174,7 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
if [ "$LISTENER_ENABLED" -eq 1 ]; then
LISTENER_SAMPLE_FILE="${TEST_FILE%.csv}-listener-$COUNTER-$i.csv"
log "Launching listener for sample $i/$NUM_TESTS..."
log "Launching listener for sample $i/$NUM_SAMPLES..."
READY_FILE="/tmp/listener_ready_${COUNTER}_${i}"
@ -195,8 +195,18 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
"${ADAPTIVE_ARGS[@]}" > >(tee "$READY_FILE") &
LISTENER_PID=$!
# Wait for the READY_FILE to contain "LISTENING_STARTED"
bash -c "until grep -q LISTENING_STARTED $READY_FILE; do sleep 0.2; done"
# Wait up to 10 seconds for LISTENING_STARTED
log "Waiting for listener to initialize (timeout in 10s)..."
for ((j = 0; j < 50; j++)); do
if grep -q LISTENING_STARTED "$READY_FILE"; then
break
fi
sleep 0.2
done
if ! grep -q LISTENING_STARTED "$READY_FILE"; then
warn "Listener did not start properly (LISTENING_STARTED not found in time). Proceeding without it."
fi
fi
log " Sample $i of $NUM_SAMPLES"