Conversation
…enacity with builtin urllib3 Retry
…ported for versions since 2.30.0 and upper
This reverts commit 1d1623f.
corva-alex-s
approved these changes
Jul 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
DataApi is suffering of a large number of connections created by applications. The issue is that Python apps establish a new connection with each request. To fix this, we need to change how we handle HTTPS requests in the SDK.
Changes
So, in the requests library, we need to properly use Session objects https://requests.readthedocs.io/en/latest/user/advanced/
That will bring all that we badly need:
https://requests.readthedocs.io/en/latest/user/advanced/#keep-alive
https://requests.readthedocs.io/en/latest/user/advanced/#example-automatic-retries
What was done:
requests.Sessionobject for making any HTTP requests fromApi(...)a.
POOL_CONNECTIONS_COUNT- Total pools countb.
POOL_MAX_SIZE- Max connections count per pool/hostc.
POOL_BLOCK- Wait until connection released or not (instantly raise an exception)d.
MAX_RETRY_COUNT- If0then retires will be disabled, otherwise retrying logic will be usedtenacityto internalurllib3.util.Retry(...)tenacityfrompython-sdkpy3.13topy3.13.3at CI version matrix in order to fix broken tests for loggingfakeredisalso according to failed some tests