From c67004af52475c2c75d7b8b1d2c374bdb9fb2aa8 Mon Sep 17 00:00:00 2001 From: Mondo Diaz Date: Wed, 4 Feb 2026 09:12:01 -0600 Subject: [PATCH] config: add HTTP pool, Redis, and updated DB pool settings --- backend/app/config.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/backend/app/config.py b/backend/app/config.py index 484c38b..6d077f8 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -22,8 +22,8 @@ class Settings(BaseSettings): database_sslmode: str = "disable" # Database connection pool settings - database_pool_size: int = 5 # Number of connections to keep open - database_max_overflow: int = 10 # Max additional connections beyond pool_size + database_pool_size: int = 20 # Number of connections to keep open + database_max_overflow: int = 30 # Max additional connections beyond pool_size database_pool_timeout: int = 30 # Seconds to wait for a connection from pool database_pool_recycle: int = ( 1800 # Recycle connections after this many seconds (30 min) @@ -53,6 +53,25 @@ class Settings(BaseSettings): ) pypi_download_mode: str = "redirect" # "redirect" (to S3) or "proxy" (stream through Orchard) + # HTTP Client pool settings + http_max_connections: int = 100 # Max connections per pool + http_max_keepalive: int = 20 # Keep-alive connections + http_connect_timeout: float = 30.0 # Connection timeout seconds + http_read_timeout: float = 60.0 # Read timeout seconds + http_worker_threads: int = 32 # Thread pool for blocking ops + + # Redis cache settings + redis_host: str = "localhost" + redis_port: int = 6379 + redis_db: int = 0 + redis_password: Optional[str] = None + redis_enabled: bool = True # Set False to disable caching + + # Cache TTL settings (seconds, 0 = no expiry) + cache_ttl_index: int = 300 # Package index pages: 5 min + cache_ttl_versions: int = 300 # Version listings: 5 min + cache_ttl_upstream: int = 3600 # Upstream source config: 1 hour + # Logging settings log_level: str = "INFO" # DEBUG, INFO, WARNING, ERROR, CRITICAL log_format: str = "auto" # "json", "standard", or "auto" (json in production)