add timeout for llama-server startup to prevent indefinite waiting

This commit is contained in:
mags0ft
2025-12-27 18:00:58 +01:00
parent 3d442d9123
commit d4ac091735
+9
View File
@@ -65,6 +65,8 @@ LD_LIBRARY_PATH=/app /app/llama-server $CACHED_LLAMA_ARGS $LLAMA_SERVER_CMD_ARGS
LLAMA_SERVER_PID=$! # store the process ID (PID) of the background command
tries_so_far=0
check_server_is_running() {
echo "start.sh: Checking if llama-server is done initializing..."
@@ -74,6 +76,13 @@ check_server_is_running() {
return 1 # failure
fi
tries_so_far=$((tries_so_far + 1))
if [ $tries_so_far -ge 120 ]; then
echo "start.sh: Error: llama-server did not start within 60 seconds."
exit 1
fi
# check if the process is still running
if ! kill -0 $LLAMA_SERVER_PID 2>/dev/null; then
echo "start.sh: Error: llama-server process has exited unexpectedly."