Fix startup sequence to ensure backend readiness

- Update start.sh to wait for Unix socket creation before starting workers
- Remove retry logic from workers since startup script ensures backend is ready
- Workers now connect immediately knowing backend socket exists
- Prevents race conditions between backend startup and worker connections
parent 0aed6a48
......@@ -72,7 +72,27 @@ start_process() {
# Start backend
start_process "backend" "$PYTHON_CMD -m vidai.backend"
$SLEEP_CMD 2
# Wait for backend to be ready
echo "Waiting for backend to be ready..."
if [ $IS_WINDOWS -eq 1 ]; then
# On Windows, just sleep
$SLEEP_CMD 3
else
# On Unix-like systems, check if socket exists
max_wait=10
for i in $(seq 1 $max_wait); do
if [ -S "/tmp/vidai_worker.sock" ]; then
echo "Backend is ready!"
break
fi
echo "Waiting for backend... ($i/$max_wait)"
$SLEEP_CMD 1
if [ $i -eq $max_wait ]; then
echo "Backend failed to start within $max_wait seconds"
exit 1
fi
done
fi
# Start workers with configured backends
start_process "analysis_worker" "$PYTHON_CMD -c \"from vidai.worker_analysis import worker_process; worker_process('$ANALYSIS_BACKEND')\""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment