Skip to content

Commit

Permalink
configure await on reads
Browse files Browse the repository at this point in the history
  • Loading branch information
j0nimost committed Oct 27, 2023
1 parent 9398204 commit 48dd134
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Kafa/Kafa.Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ public static async ValueTask<RowEnumerable> ReadAsync(Stream ioStream, KafaOpti

var readerState = new KafaReadState((int)ioStream.Length, options);

return await ReadProcessorAsync(readerState, tr, cancellationToken);
return await ReadProcessorAsync(readerState, tr, cancellationToken).ConfigureAwait(false);
}

public static async ValueTask<IEnumerable<T>> ReadAsync<T>(Stream ioStream, KafaOptions? options = null, CancellationToken cancellationToken = default)
{
var rows = await ReadAsync(ioStream, options, cancellationToken);
var rows = await ReadAsync(ioStream, options, cancellationToken).ConfigureAwait(false);
var typeInfo = new KafaTypeInfo(typeof(T), options);
var reflection = new KafaReflection(typeInfo);
return reflection.SetProperties<T>(rows);
}

private static async ValueTask<RowEnumerable> ReadProcessorAsync(KafaReadState kafaReadState, TextReader tr, CancellationToken cancellationToken=default)
{
await kafaReadState.ReadStateAsync(tr, cancellationToken); // read first
await kafaReadState.ReadStateAsync(tr, cancellationToken).ConfigureAwait(false); // read first
kafaReadState.ProcessBuffer(); // process buffer aka Parse

var reader = new KafaReader(kafaReadState);
Expand Down

0 comments on commit 48dd134

Please sign in to comment.