diff --git a/src/HotChocolate/Core/src/Types/Execution/Processing/WorkScheduler.Execute.cs b/src/HotChocolate/Core/src/Types/Execution/Processing/WorkScheduler.Execute.cs index 1a2a89ade5f..411a7180b8b 100644 --- a/src/HotChocolate/Core/src/Types/Execution/Processing/WorkScheduler.Execute.cs +++ b/src/HotChocolate/Core/src/Types/Execution/Processing/WorkScheduler.Execute.cs @@ -32,8 +32,15 @@ public ValueTask WaitForCompletionAsync(int executionBranchId) { AssertNotPooled(); - return _activeBranches.TryGetValue(executionBranchId, out var branch) - ? branch.WaitForCompletionAsync(operationContext.RequestAborted) + Branch? branch; + + lock (_sync) + { + _activeBranches.TryGetValue(executionBranchId, out branch); + } + + return branch is not null + ? branch.WaitForCompletionAsync(_ct) : ValueTask.CompletedTask; }