Use shared httpx.Client in HTTPXTransport for connection pooling#2935
Merged
adamtheturtle merged 2 commits intomainfrom Mar 29, 2026
Merged
Use shared httpx.Client in HTTPXTransport for connection pooling#2935adamtheturtle merged 2 commits intomainfrom
adamtheturtle merged 2 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| def close(self) -> None: | ||
| """Close the transport and release resources.""" | ||
| ... # pylint: disable=unnecessary-ellipsis |
There was a problem hiding this comment.
Protocol's new close() breaks custom transport implementations
Medium Severity
Adding close() to the @runtime_checkable Transport protocol is a breaking change. Since beartype enforces the protocol at runtime via isinstance checks, any existing user-defined transport that only implements __call__ will now fail validation when passed to VWS, CloudRecoService, or VuMarkService. The close() method needs to exist on every Transport implementation, but external consumers have no way of knowing this without a version bump or deprecation notice.
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.


Summary
HTTPXTransportwas usinghttpx.request()(module-level function) for every call, creating a new TCP+TLS connection each time with no connection pooling.httpx.Clientinstance and callsself._client.request(), matching the pattern already used byAsyncHTTPXTransport.close(),__enter__, and__exit__methods toHTTPXTransportfor proper resource management.close()to theTransportprotocol andRequestsTransportfor parity withAsyncTransport.aclose().HTTPXTransport.Test plan
HTTPXTransporttests pass