File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
src/HotChocolate/Core/src/Fetching Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ private async Task EvaluateAndDispatchAsync(
149149
150150 // Spin-wait briefly to give executing resolvers time to add more
151151 // data requirements to the open batches.
152- WaitForMoreBatchActivity ( lastModified ) ;
152+ await WaitForMoreBatchActivityAsync ( lastModified ) ;
153153 }
154154 }
155155
@@ -201,9 +201,9 @@ private void EvaluateOpenBatches(
201201 }
202202 }
203203
204- private void WaitForMoreBatchActivity ( long lastModified )
204+ private async Task WaitForMoreBatchActivityAsync ( long lastModified )
205205 {
206- const int maxSpinUs = 12 ;
206+ const int maxSpinUs = 50 ;
207207
208208 var lastSubscribed = Volatile . Read ( ref _lastSubscribed ) ;
209209 var lastEnqueued = Volatile . Read ( ref _lastEnqueued ) ;
@@ -219,19 +219,9 @@ private void WaitForMoreBatchActivity(long lastModified)
219219 }
220220
221221 var ageUs = TicksToUs ( Stopwatch . GetTimestamp ( ) - lastModified ) ;
222- if ( ageUs <= maxSpinUs && ThreadPoolHasHeadroom ( ) )
222+ if ( ageUs <= maxSpinUs )
223223 {
224- var sw = new SpinWait ( ) ;
225- var start = Stopwatch . GetTimestamp ( ) ;
226-
227- while ( TicksToUs ( Stopwatch . GetTimestamp ( ) - start ) < maxSpinUs )
228- {
229- sw . SpinOnce ( ) ;
230- if ( sw . Count >= 8 )
231- {
232- Thread . Yield ( ) ;
233- }
234- }
224+ await Task . Yield ( ) ;
235225 }
236226 }
237227
You can’t perform that action at this time.
0 commit comments