Charan S commited on
Commit ·
9960f53
1
Parent(s): 57675a4
fix: POSIX-compatible poll loop
Browse files176 unmodified lines177178179180181182183184185186187188189190176 unmodified lines@asynccontextmanagerasync def lifespan(app: FastAPI):# Seed DB on startup — idempotent upserts, safe to call every time.# Ensures agents + tenant config exist on a fresh Supabase instance.try:from seed import run_seedawait run_seed()except Exception as _seed_err:logger.warning("Startup seed failed (non-fatal): %s", _seed_err)# Load active tenant config first — all voice/agent code depends on itawait load_active_config()176 unmodified lines177178179180181182176 unmodified lines@asynccontextmanagerasync def lifespan(app: FastAPI):# Load active tenant config first — all voice/agent code depends on itawait load_active_config()
32 unmodified lines333435363738394032 unmodified linespython -m voice.agent_worker start &WORKER_PID=$!# If either process exits, kill the other and propagate the exit codewait -n $API_PID $WORKER_PIDEXIT_CODE=$?kill $API_PID $WORKER_PID 2>/dev/nullexit $EXIT_CODE32 unmodified lines33343536373839404142434445464748495032 unmodified linespython -m voice.agent_worker start &WORKER_PID=$!# If either process exits, kill the other and propagate the exit code.# wait -n is bash-only; poll manually for POSIX sh (HuggingFace uses dash).while true; doif ! kill -0 $API_PID 2>/dev/null; thenwait $API_PID; EXIT_CODE=$?kill $WORKER_PID 2>/dev/nullexit $EXIT_CODEfiif ! kill -0 $WORKER_PID 2>/dev/null; thenwait $WORKER_PID; EXIT_CODE=$?kill $API_PID 2>/dev/nullexit $EXIT_CODEfisleep 2done
main.py-8
start.sh+15-5