Skip to content

Commit

Permalink
fix: optimize performance reading from buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hermogenes committed Jul 12, 2024
1 parent bbe9f46 commit c482138
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/LibSql.Http.Client/Response/ResultReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ public static async Task<ResultReader> ParseAsync(
HashSet<int>? resultsToIgnore = null,
CancellationToken cancellationToken = default)
{
using var stream = new MemoryStream();
await content.CopyToAsync(stream, cancellationToken);
await content.LoadIntoBufferAsync();

await using var stream = await content.ReadAsStreamAsync(cancellationToken);

stream.Seek(0, SeekOrigin.Begin);

return await ParseAsync(stream, resultsToIgnore, cancellationToken);
Expand Down

0 comments on commit c482138

Please sign in to comment.