File tree 1 file changed +10
-27
lines changed
src/HotChocolate/Core/src/Execution
1 file changed +10
-27
lines changed Original file line number Diff line number Diff line change @@ -241,47 +241,30 @@ private async IAsyncEnumerable<IOperationResult> ExecuteBatchStream(
241
241
}
242
242
243
243
var buffer = new IOperationResult [ 8 ] ;
244
- int bufferCount ;
245
244
246
245
do
247
246
{
248
- bufferCount = completed . TryPopRange ( buffer ) ;
247
+ var resultCount = completed . TryPopRange ( buffer ) ;
249
248
250
- for ( var i = 0 ; i < bufferCount ; i ++ )
249
+ for ( var i = 0 ; i < resultCount ; i ++ )
251
250
{
252
251
yield return buffer [ i ] ;
253
252
}
254
253
255
- if ( bufferCount == 0 )
254
+ if ( completed . IsEmpty && tasks . Count > 0 )
256
255
{
257
- if ( tasks . Any ( t => ! t . IsCompleted ) )
258
- {
259
- var task = await Task . WhenAny ( tasks ) ;
256
+ var task = await Task . WhenAny ( tasks ) ;
260
257
261
- if ( task . Status is not TaskStatus . RanToCompletion )
262
- {
263
- // we await to throw if it's not successful.
264
- await task ;
265
- }
266
-
267
- tasks . Remove ( task ) ;
268
- }
269
- else
258
+ // we await to throw if it's not successful.
259
+ if ( task . Status is not TaskStatus . RanToCompletion )
270
260
{
271
- foreach ( var task in tasks )
272
- {
273
- if ( task . Status is not TaskStatus . RanToCompletion )
274
- {
275
- // we await to throw if it's not successful.
276
- await task ;
277
- }
278
- }
279
-
280
- tasks . Clear ( ) ;
261
+ await task ;
281
262
}
263
+
264
+ tasks . Remove ( task ) ;
282
265
}
283
266
}
284
- while ( tasks . Count > 0 || bufferCount > 0 ) ;
267
+ while ( tasks . Count > 0 || ! completed . IsEmpty ) ;
285
268
}
286
269
287
270
private static IOperationRequest WithServices ( IOperationRequest request , IServiceProvider services )
You can’t perform that action at this time.
0 commit comments