diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.json index 0247f03e023..2248d1f1d59 100644 --- a/basedpyright-code-budget.json +++ b/basedpyright-code-budget.json @@ -1,9 +1,9 @@ { "reportAny": { - "limit": 32379 + "limit": 32138 }, "reportArgumentType": { - "limit": 2633 + "limit": 2629 }, "reportAssignmentType": { "limit": 329 @@ -24,7 +24,7 @@ "limit": 42 }, "reportExplicitAny": { - "limit": 9602 + "limit": 9394 }, "reportFunctionMemberAccess": { "limit": 11 @@ -54,10 +54,10 @@ "limit": 0 }, "reportMissingParameterType": { - "limit": 5857 + "limit": 5853 }, "reportMissingTypeArgument": { - "limit": 15831 + "limit": 15820 }, "reportMissingTypeStubs": { "limit": 41 @@ -99,19 +99,19 @@ "limit": 0 }, "reportUnknownArgumentType": { - "limit": 45456 + "limit": 45435 }, "reportUnknownLambdaType": { "limit": 113 }, "reportUnknownMemberType": { - "limit": 40416 + "limit": 40396 }, "reportUnknownParameterType": { - "limit": 20296 + "limit": 20281 }, "reportUnknownVariableType": { - "limit": 31976 + "limit": 31952 }, "reportUnnecessaryCast": { "limit": 177 diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index f2eb8edb91c..434ba7b6b47 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -839,14 +839,21 @@ async def _initialize_shared_aiohttp_session(): _build_aiohttp_keepalive_socket_factory, ) - connector = TCPConnector( - keepalive_timeout=AIOHTTP_KEEPALIVE_TIMEOUT, - ttl_dns_cache=AIOHTTP_TTL_DNS_CACHE, - enable_cleanup_closed=AIOHTTP_NEEDS_CLEANUP_CLOSED, - limit=AIOHTTP_CONNECTOR_LIMIT if AIOHTTP_CONNECTOR_LIMIT > 0 else 100, - limit_per_host=AIOHTTP_CONNECTOR_LIMIT_PER_HOST if AIOHTTP_CONNECTOR_LIMIT_PER_HOST > 0 else 0, - socket_factory=_build_aiohttp_keepalive_socket_factory(), - ) + connector_kwargs: Dict[str, Any] = { + "keepalive_timeout": AIOHTTP_KEEPALIVE_TIMEOUT, + "ttl_dns_cache": AIOHTTP_TTL_DNS_CACHE, + } + if AIOHTTP_NEEDS_CLEANUP_CLOSED: + connector_kwargs["enable_cleanup_closed"] = True + if AIOHTTP_CONNECTOR_LIMIT > 0: + connector_kwargs["limit"] = AIOHTTP_CONNECTOR_LIMIT + if AIOHTTP_CONNECTOR_LIMIT_PER_HOST > 0: + connector_kwargs["limit_per_host"] = AIOHTTP_CONNECTOR_LIMIT_PER_HOST + socket_factory = _build_aiohttp_keepalive_socket_factory() + if socket_factory is not None: + connector_kwargs["socket_factory"] = socket_factory + + connector = TCPConnector(**connector_kwargs) session = ClientSession(connector=connector) verbose_proxy_logger.info( diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index 7dd5f06f4fb..1c955cf5ea6 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,6 +1,6 @@ { "ANN001": { - "limit": 3106 + "limit": 3102 }, "ANN002": { "limit": 69 @@ -24,7 +24,7 @@ "limit": 130 }, "ANN401": { - "limit": 1821 + "limit": 1757 }, "ASYNC230": { "limit": 14 @@ -222,7 +222,7 @@ "limit": 38 }, "RET504": { - "limit": 713 + "limit": 712 }, "RUF010": { "limit": 874 @@ -306,7 +306,7 @@ "limit": 9 }, "TID251": { - "limit": 2649 + "limit": 2648 }, "TRY002": { "limit": 547 @@ -363,6 +363,6 @@ "limit": 105 }, "UP045": { - "limit": 17788 + "limit": 17770 } }