From c96fdf7d31c3ab983f4eec4ef7a25cd81edc7ac9 Mon Sep 17 00:00:00 2001 From: Nicolas Thumann Date: Fri, 17 May 2024 19:19:48 +0200 Subject: [PATCH] Fix typo in `ConnectionPool` and `AsyncConnectionPool` (#908) Co-authored-by: Tom Christie --- httpcore/_async/connection_pool.py | 6 +++--- httpcore/_sync/connection_pool.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/httpcore/_async/connection_pool.py b/httpcore/_async/connection_pool.py index 018b0ba2..214dfc4b 100644 --- a/httpcore/_async/connection_pool.py +++ b/httpcore/_async/connection_pool.py @@ -262,7 +262,7 @@ def _assign_requests_to_connections(self) -> List[AsyncConnectionInterface]: queued_requests = [request for request in self._requests if request.is_queued()] for pool_request in queued_requests: origin = pool_request.request.url.origin - avilable_connections = [ + available_connections = [ connection for connection in self._connections if connection.can_handle_request(origin) and connection.is_available() @@ -277,9 +277,9 @@ def _assign_requests_to_connections(self) -> List[AsyncConnectionInterface]: # 2. We can create a new connection to handle the request. # 3. We can close an idle connection and then create a new connection # to handle the request. - if avilable_connections: + if available_connections: # log: "reusing existing connection" - connection = avilable_connections[0] + connection = available_connections[0] pool_request.assign_to_connection(connection) elif len(self._connections) < self._max_connections: # log: "creating new connection" diff --git a/httpcore/_sync/connection_pool.py b/httpcore/_sync/connection_pool.py index 8dcf348c..01bec59e 100644 --- a/httpcore/_sync/connection_pool.py +++ b/httpcore/_sync/connection_pool.py @@ -262,7 +262,7 @@ def _assign_requests_to_connections(self) -> List[ConnectionInterface]: queued_requests = [request for request in self._requests if request.is_queued()] for pool_request in queued_requests: origin = pool_request.request.url.origin - avilable_connections = [ + available_connections = [ connection for connection in self._connections if connection.can_handle_request(origin) and connection.is_available() @@ -277,9 +277,9 @@ def _assign_requests_to_connections(self) -> List[ConnectionInterface]: # 2. We can create a new connection to handle the request. # 3. We can close an idle connection and then create a new connection # to handle the request. - if avilable_connections: + if available_connections: # log: "reusing existing connection" - connection = avilable_connections[0] + connection = available_connections[0] pool_request.assign_to_connection(connection) elif len(self._connections) < self._max_connections: # log: "creating new connection"