File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,16 +184,25 @@ static async Task<QueryResult<Queue<object[]>>> RetrieveAsyncInternal(DbDataRead
184184
185185 var t = token ?? CancellationToken . None ;
186186 var buffer = new Queue < object [ ] > ( ) ;
187- if ( readStarted || useReadAsync ? await reader . ReadAsync ( t ) : ( ! t . IsCancellationRequested && reader . Read ( ) ) )
188- {
189- do
190- {
191- buffer . Enqueue ( handler ( reader ) ) ;
192- }
193- while ( useReadAsync ? await reader . ReadAsync ( t ) : ( ! t . IsCancellationRequested && reader . Read ( ) ) ) ;
194- }
195187
196- if ( ! useReadAsync ) t . ThrowIfCancellationRequested ( ) ;
188+ if ( ! readStarted )
189+ readStarted = useReadAsync
190+ ? await reader . ReadAsync ( t )
191+ : ( ! t . IsCancellationRequested && reader . Read ( ) ) ;
192+
193+ if ( readStarted )
194+ {
195+ do
196+ {
197+ buffer . Enqueue ( handler ( reader ) ) ;
198+ }
199+ while ( useReadAsync
200+ ? await reader . ReadAsync ( t )
201+ : ( ! t . IsCancellationRequested && reader . Read ( ) ) ) ;
202+ }
203+
204+ if ( ! useReadAsync )
205+ t . ThrowIfCancellationRequested ( ) ;
197206
198207 return new QueryResult < Queue < object [ ] > > (
199208 ordinals ,
You can’t perform that action at this time.
0 commit comments