feat: Add multi-worker support for uvicorn deployment

- Configure uvicorn to support multiple worker processes
- Add worker count configuration via environment variables
- Optimize Docker deployment for better resource utilization
- Enable horizontal scaling within single container instance

Improves application throughput and CPU utilization on multi-core systems.
This commit is contained in:
bupt_rain 2025-06-26 16:13:49 +08:00
parent 513816326d
commit 7f6510b761

View File

@ -422,6 +422,7 @@ async def safe_lifespan(app: FastAPI):
os.makedirs(worker_npx_cache, exist_ok=True)
worker_env = {**env}
logger.info(f"worker_env after copy ({len(worker_env)} items):")
worker_env.update({
"NPM_CONFIG_CACHE": worker_npm_cache,
"npm_config_cache": worker_npm_cache,