chore: remove gunicorn in favor of uvicorn workers (#3761)

This commit is contained in:
Hayden
2024-06-20 22:52:09 -05:00
committed by GitHub
parent adab596683
commit 4d1381c055
9 changed files with 44 additions and 160 deletions

View File

@@ -233,6 +233,19 @@ class AppSettings(BaseSettings):
but will incur additional API costs
"""
# ===============================================
# Web Concurrency
WORKER_PER_CORE: int = 1
"""Old gunicorn env for workers per core."""
UVICORN_WORKERS: int = 1
"""Number of Uvicorn workers to run."""
@property
def WORKERS(self) -> int:
return max(1, self.WORKER_PER_CORE * self.UVICORN_WORKERS)
@property
def OPENAI_ENABLED(self) -> bool:
"""Validates OpenAI settings are all set"""

View File

@@ -11,7 +11,7 @@ def main():
port=settings.API_PORT,
log_level=settings.LOG_LEVEL.lower(),
log_config=log_config(),
workers=1,
workers=settings.WORKERS,
forwarded_allow_ips=settings.HOST_IP,
)