OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
687 stars 349 forks source link

Do not force flush when ODataUtf8JsonWriter buffer threshold is reached #3102

Closed habbes closed 2 weeks ago

habbes commented 2 weeks ago

Issues

This pull request fixes #3099 .

This PR is an 8.x port of the following 7.x PR: https://github.com/OData/odata.net/pull/3101

Description

This PR removes the "Flush()" call from the FlushIfBufferThresholdReached method and renames the method to DrainBufferIfThresholdReached. This method no longer forces a flush of the underlying stream, instead it only writes to the stream but leaves the stream to decide whether/when to flush. The user can still force a flush by explicitly calling the Flush() method.

Checklist (Uncheck if it is not completed)