Skip to content

Commit 3cc7e38

Browse files
luminitavoicudianpopa
authored andcommitted
CI: update max saved connections limit
Signed-off-by: Luminita Voicu <[email protected]>
1 parent affc880 commit 3cc7e38

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

tests/framework/http.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,31 @@ def __init__(self):
1919
"""Create a Session object and set the is_good_response callback."""
2020
super().__init__()
2121

22+
# 'UnixAdapter` saves in the pool at most 'pool_connections'
23+
# connections. When a new request is made, the adapter tries to match
24+
# that request with an already existing connection from the pool, by
25+
# comparing their url.
26+
# If there's a match, then the adapter uses the connection from the
27+
# pool to make the new request.
28+
# Otherwise, a new connection is created and saved in the pool. If
29+
# there is no space in the pool, the new connection will replace the
30+
# least recently used one in the pool. The evicted connection will be
31+
# closed.
32+
#
2233
# The `pool_connections` argument indicates the maximum number of
23-
# open connections allowed at a time. This value is set to 10 for
24-
# consistency with the micro-http's `MAX_CONNECTIONS`.
25-
self.mount(DEFAULT_SCHEME, UnixAdapter(pool_connections=10))
34+
# connection saved in the pool, not the maximum number of open
35+
# connections allowed at the same time
36+
# (see https://urllib3.readthedocs.io/en/stable/advanced-usage.html).
37+
#
38+
# We set this value to be equal to micro-http's `MAX_CONNECTIONS` - 1.
39+
# This is because when reaching the `pool_connection` limit, it is not
40+
# guaranteed that the event to close the connection will be received
41+
# before the event that results in creating a new connection (this
42+
# depends on the kernel). In case the two events are not received in
43+
# the same order, or are received together, the server might try to add
44+
# a new connection before removing the old one, resulting in a
45+
# `SERVER_FULL_ERROR`.
46+
self.mount(DEFAULT_SCHEME, UnixAdapter(pool_connections=9))
2647

2748
def is_good_response(response: int):
2849
"""Return `True` for all HTTP 2xx response codes."""

0 commit comments

Comments
 (0)