Periodically flush when using PipeWriter in Json#102541
Merged
BrennanConroy merged 9 commits intodotnet:mainfrom May 28, 2024
Merged
Periodically flush when using PipeWriter in Json#102541BrennanConroy merged 9 commits intodotnet:mainfrom
BrennanConroy merged 9 commits intodotnet:mainfrom
Conversation
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.cs
Outdated
Show resolved
Hide resolved
Member
I would recommend removing it, as it doesn't really serve purpose anymore. checking if the writer |
davidfowl
reviewed
May 22, 2024
src/libraries/Common/src/System/Text/Json/PooledByteBufferWriter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.cs
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Outdated
Show resolved
Hide resolved
Member
|
One of the new tests seems to have failed once in CI. |
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.cs
Outdated
Show resolved
Hide resolved
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
davidfowl
reviewed
May 23, 2024
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
davidfowl
reviewed
May 23, 2024
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.WriteTests.cs
Outdated
Show resolved
Hide resolved
halter73
reviewed
May 23, 2024
...System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.WriteHelpers.cs
Outdated
Show resolved
Hide resolved
Member
|
This change looks really good! |
davidfowl
approved these changes
May 28, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Makes
PooledByteBufferWriterimplementPipeWriterand usesPipeWriter.UnflushedBytesto check whether resumable json converters should let the bytes be flushed.Fixes #66102 and unblocks dotnet/aspnetcore#55740
Didn't removeIAsyncSerializationBufferWriterContextyet because it would require checkingBufferWriter is IDisposableand passing theFlushThresholdvalue into the serialize functions.We throw if
PipeWriter.CanGetUnflushedBytes == falseandstate.FlushThreshold > 0as it could lead to excess buffering for large json payloads. We could consider giving users a way to opt-in to the bad behavior in the future. But currently there is no way to setstate.FlushThresholdin thePipeWritercase yet.