Compare commits

...

5 Commits

Author SHA1 Message Date
Cian Johnston e6b9800f8e Revert "DNM: testing in claude code module"
This reverts commit 9029bd1555.
2026-01-07 17:38:28 +00:00
Cian Johnston 9a320adf91 bump timeouts 2026-01-07 17:34:46 +00:00
Cian Johnston da17c9881a bump timeout, fix infinite loop 2026-01-07 17:22:03 +00:00
Cian Johnston 9029bd1555 DNM: testing in claude code module 2026-01-07 17:18:17 +00:00
Cian Johnston 82fb00a4e1 chore(agentapi): improve agentapi-wait-for-start.sh 2026-01-07 17:12:19 +00:00
@@ -3,30 +3,57 @@ set -o errexit
set -o pipefail
port=${1:-3284}
start_timeout=${2:-60}
listen_timeout=${3:-60}
# This script waits for the agentapi server to start on port 3284.
# It considers the server started after 3 consecutive successful responses.
agentapi_started=false
echo "Waiting for agentapi server to start on port $port..."
for i in $(seq 1 150); do
echo "Waiting for agentapi process to start..."
start=$(date +%s)
while true; do
now=$(date +%s)
elapsed=$(( now - start ))
if [[ "${elapsed}" -gt "${start_timeout}" ]]; then
echo "agentapi process not found after ${start_timeout} seconds"
exit 1
fi
set +e
agentapi_pid=$(pidof agentapi)
set -e
if [[ -z "${agentapi_pid}" ]]; then
echo "agentapi process not found (${elapsed}/${start_timeout})"
sleep 1
continue
fi
echo "agentapi process started with pid ${agentapi_pid} after ${elapsed} seconds"
break
done
echo "Waiting for agentapi to start listening on port ${port}..."
start=$(date +%s)
while true; do
now=$(date +%s)
elapsed=$(( now - start ))
if [[ "${elapsed}" -gt "${listen_timeout}" ]]; then
echo "agentapi server not listening on port ${port} after ${listen_timeout} seconds"
exit 1
fi
for j in $(seq 1 3); do
sleep 0.1
if curl -fs -o /dev/null "http://localhost:$port/status"; then
echo "agentapi response received ($j/3)"
if curl -fs -o /dev/null "http://localhost:${port}/status"; then
echo "agentapi response received (${j}/3)"
sleep 0.1
continue
else
echo "agentapi server not responding ($i/15)"
echo "agentapi server not responding (${elapsed}/${listen_timeout})"
sleep 1
continue 2
fi
done
agentapi_started=true
echo "agentapi server started responding after ${elapsed} seconds"
break
done
if [ "$agentapi_started" != "true" ]; then
echo "Error: agentapi server did not start on port $port after 15 seconds."
exit 1
fi
echo "agentapi server started on port $port."
echo "agentapi server started on port ${port}."