Skip to content
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

ClientModel: Shared HttpClient in PipelineTransport, and a couple more updates #41455

Merged
merged 9 commits into from
Jan 23, 2024

Conversation

annelo-msft
Copy link
Member

@annelo-msft annelo-msft commented Jan 22, 2024

This PR contains three changes:

1. Use a shared HttpClient instance in HttpClientPipelineTransport

Requested in this PR comment, this change was postponed because it complicates HttpClientPipelineTransport's Dispose method given the need to do reference counting on the shared HttpClient used by possibly multiple transport instances.

Fixes #41301

2. Change ClientRetryPolicy.WaitAsync method return types to Task

Since ValueTask is slower if the method does not return synchronously, and the Wait* methods are expected to wait some time interval before returning, changing these methods to return Task instead to get the perf benefit in the majority case.

3. Isolating "should write as JSON" logic to a single place

Addressing feedback from this PR comment. This moves the logic to decide whether to write a persistable model as JSON to a single place and gives a higher hit rate on the high-performance model-writing path from BinaryContent.

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

System.ClientModel

@annelo-msft annelo-msft merged commit ba41182 into Azure:main Jan 23, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants