Fix 2 bugs and improve performance from O(N²+NxM) to O(N+M) in _assign_requests_to_connections by VictorPrins · Pull Request #1035 · encode/httpcore
Redesign of the connection pool's core request-connection assignment algorithm (_assign_requests_to_connections) fixing bugs and performance issues identified in the original implementation. Fixes: - Fixed incorrect idle connection counting, causing premature connection evictions - Fixed bug where multiple requests could be assigned to the same HTTP/1.1 connection, leading to ConnectionNotAvailable errors Performance improvements: - Reduced time complexity from O(N²+NxM) to O(N+M) where N=connections, M=requests