diff --git a/api/app.py b/api/app.py index 3a5255e..ab3f9cb 100644 --- a/api/app.py +++ b/api/app.py @@ -177,6 +177,15 @@ app.add_middleware( @app.on_event("startup") async def startup_event(): """Initialize service on startup.""" + # Configure thread pool size for uvicorn (default is 40, set to 48) + try: + import anyio.to_thread + limiter = anyio.to_thread.current_default_thread_limiter() + limiter.total_tokens = 48 + logger.info(f"Thread pool size set to {limiter.total_tokens}") + except Exception as e: + logger.warning(f"Failed to set thread pool size: {e}, using default") + es_host = os.getenv("ES_HOST", "http://localhost:9200") logger.info("Starting E-Commerce Search API (Multi-Tenant)") logger.info(f"Elasticsearch Host: {es_host}") diff --git a/api/indexer_app.py b/api/indexer_app.py index 2de6c51..914ae39 100644 --- a/api/indexer_app.py +++ b/api/indexer_app.py @@ -150,6 +150,15 @@ app = FastAPI( @app.on_event("startup") async def startup_event(): + # Configure thread pool size for uvicorn (default is 40, set to 48) + try: + import anyio.to_thread + limiter = anyio.to_thread.current_default_thread_limiter() + limiter.total_tokens = 48 + logger.info(f"Thread pool size set to {limiter.total_tokens}") + except Exception as e: + logger.warning(f"Failed to set thread pool size: {e}, using default") + es_host = os.getenv("ES_HOST", "http://localhost:9200") logger.info("Starting Indexer API service") logger.info(f"Elasticsearch Host: {es_host}") -- libgit2 0.21.2