-
Notifications
You must be signed in to change notification settings - Fork 78
[BTS-1515] Pass PoolTimeout as argument #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #257 +/- ##
==========================================
- Coverage 98.58% 98.57% -0.02%
==========================================
Files 26 26
Lines 3899 3927 +28
==========================================
+ Hits 3844 3871 +27
- Misses 55 56 +1
|
arango/http.py
Outdated
self, | ||
pool_connections: int = DEFAULT_POOLSIZE, | ||
pool_maxsize: int = DEFAULT_POOLSIZE, | ||
pool_timeout: Union[int, float, None] = DEFAULT_POOL_TIMEOUT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusingly named. There is an argument to urlopen called pool_timeout
which is the timeout to wait for a connection from the pool and only matters if blocking=True
. This has nothing to do with the actual connections, just whether requests block to get a cached connection or just make a new one if all cached connections are busy.
You're mapping this to timeout
which is a ConnectionPool argument that sets the default connect/read timeout for each connection. But because you set timeout
on each request, this pool level default will always be ignored
@@ -128,7 +205,7 @@ def send_request( | |||
data=data, | |||
headers=headers, | |||
auth=auth, | |||
timeout=self.REQUEST_TIMEOUT, | |||
timeout=self.request_timeout, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the result of this is that pool_timeout
which maps to timeout
on the connection pool, will always be ignored https://urllib3.readthedocs.io/en/stable/reference/urllib3.connectionpool.html#urllib3.HTTPConnectionPool.urlopen
Hi @jmb-altana, Your engagement is highly appreciated! I've considered your feedback and decided to rename the argument to While If you have any other requests or opinions, I would be very interested in hearing them. Thank you once again for your input! |
This PR makes the
DefaultHTTPClient
more flexible, adding the following new parameters:EmptyPoolError
if no connection is available within the time periodThe ones prefixed with _pool are all passed to the
PoolManager
. Note that these values cannot be changed once the HTTP client has been created.The following constants were already used before, but are now configurable as parameters:
Note that
request_timeout
is mapped to the parameter with the same name of the HTTP client. Unlike the other parameters, this one can be changed.The default values stay the same. If clients don't specify any parameters, nothing changes.
Example