mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-25 08:48:13 +02:00
feat: add FASTAPI_WORKERS parameter
This commit is contained in:
parent
7c0015917d
commit
ac474578d5
5 changed files with 123 additions and 23 deletions
|
|
@ -61,7 +61,16 @@ start() {
|
|||
|
||||
start ari_manager python -m api.services.telephony.ari_manager
|
||||
start campaign_orchestrator python -m api.services.campaign.campaign_orchestrator
|
||||
start uvicorn uvicorn api.app:app --host 0.0.0.0 --port "$UVICORN_BASE_PORT" --workers "$FASTAPI_WORKERS"
|
||||
|
||||
# Spawn FASTAPI_WORKERS independent uvicorn processes on consecutive ports
|
||||
# starting at UVICORN_BASE_PORT. nginx upstream (configured in setup_remote.sh)
|
||||
# balances across them with least_conn — better than uvicorn --workers for
|
||||
# long-lived WebSocket connections, which would otherwise stick to whichever
|
||||
# worker accepted them first.
|
||||
for ((i=0; i<FASTAPI_WORKERS; i++)); do
|
||||
port=$((UVICORN_BASE_PORT + i))
|
||||
start "uvicorn$i" uvicorn api.app:app --host 0.0.0.0 --port "$port" --workers 1
|
||||
done
|
||||
|
||||
for ((i=1; i<=ARQ_WORKERS; i++)); do
|
||||
start "arq$i" python -m arq api.tasks.arq.WorkerSettings --custom-log-dict api.tasks.arq.LOG_CONFIG
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue