Replace httpx.Client with httpx.AsyncClient in the listed async FastAPI handlers to avoid blocking the uvicorn event loop. Update code and add tests validating endpoints remain responsive under long-running operations.
Affected files/handlers (from parent issue #219):
- server/routes.py: POST /v1/models/pull (server/routes.py:487)
- server/routes.py: DELETE /v1/models/{name} (server/routes.py:518)
- server/api_routes.py: POST /v1/speech/transcribe (server/api_routes.py:685)
- server/agent_manager_routes.py: SendBlue verify/register/test (lines ~1775,1839,1890)
Implementation notes:
- Use async with httpx.AsyncClient(...) and await client.post/get
- For CPU-bound tasks (e.g., Whisper), offload with asyncio.to_thread
- Add unit/integration tests that mock remote endpoints and simulate long-duration calls
Replace httpx.Client with httpx.AsyncClient in the listed async FastAPI handlers to avoid blocking the uvicorn event loop. Update code and add tests validating endpoints remain responsive under long-running operations.
Affected files/handlers (from parent issue #219):
Implementation notes: