-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enhance StreamResponse handling and update dependencies #121
Conversation
eab800f
to
2300050
Compare
src/Elastic.Transport/Components/TransportClient/HttpRequestInvoker.cs
Outdated
Show resolved
Hide resolved
src/Elastic.Transport/Components/Pipeline/DefaultResponseBuilder.cs
Outdated
Show resolved
Hide resolved
src/Elastic.Transport/Components/Pipeline/DefaultResponseBuilder.cs
Outdated
Show resolved
Hide resolved
Notes from latest changes: We have now unsealed StreamResponse to allow for derived responses that rely on the stream (such as the potential specialised bulk response for the ingest work. While testing, I noticed that with |
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.
LGTM!
Sorry about the conflict! |
Updated `ResponseBuilderDefaults` to include `StreamResponse` in `SpecialTypes`. Refactored `SetBodyCoreAsync` in `DefaultResponseBuilder.cs` for readability and removed unnecessary `using` statements. Modified `RequestCoreAsync` in `HttpWebRequestInvoker.cs` and `BuildResponseAsync` in `InMemoryRequestInvoker.cs` to handle `StreamResponse` types with proper disposal. Updated `Elastic.Transport.csproj` to reference `System.Text.Json` version `8.0.5`.
Renamed variable from `receive` to `receivedResponse` in `RequestCoreAsync` method across `HttpRequestInvoker.cs` and `HttpWebRequestInvoker.cs` for better clarity. Updated `using` statements accordingly. Added `try-catch` blocks around response handling logic to ensure `receivedResponse` is disposed of properly, preventing resource leaks. Adjusted finalizer in `StreamResponse` to use `receivedResponse.Dispose()`. Properly indented OpenTelemetry attributes setting logic within the `try` block.
Add `LeaveOpen` property to `StreamResponse` and `TransportResponse` classes for flexible stream management.
d1c4f20
to
20bcdf2
Compare
Updated
ResponseBuilderDefaults
to includeStreamResponse
inSpecialTypes
. RefactoredSetBodyCoreAsync
inDefaultResponseBuilder.cs
for readability and removed unnecessaryusing
statements. ModifiedRequestCoreAsync
inHttpWebRequestInvoker.cs
andBuildResponseAsync
inInMemoryRequestInvoker.cs
to handleStreamResponse
types with proper disposal. UpdatedElastic.Transport.csproj
to referenceSystem.Text.Json
version8.0.5
.