Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public async Task<IExecutionResult> SubscribeAsync(
var subscriptionResult = await subscriptionNode.SubscribeAsync(context, executionCts.Token);
var executionState = context.ExecutionState;

cancellationRegistration = executionCts.Token.Register(() => executionState.Signal.TryResetToIdle());
cancellationRegistration = executionCts.Token.Register(
static state => Unsafe.As<AsyncAutoResetEvent>(state)!.TryResetToIdle(),
executionState.Signal);

if (subscriptionResult.Status is not ExecutionStatus.Success)
{
Expand Down Expand Up @@ -120,8 +122,9 @@ private static async Task ExecuteQueryAsync(
{
var executionState = context.ExecutionState;

await using var cancellationRegistration =
cancellationToken.Register(() => executionState.Signal.TryResetToIdle());
await using var cancellationRegistration = cancellationToken.Register(
static state => Unsafe.As<AsyncAutoResetEvent>(state)!.TryResetToIdle(),
executionState.Signal);

// GraphQL queries allow us to execute the plan by using full parallelism.
// We fill the backlog with all nodes from the operation plan.
Expand Down Expand Up @@ -166,8 +169,9 @@ private static async Task ExecuteMutationAsync(
{
var executionState = context.ExecutionState;

await using var cancellationRegistration =
cancellationToken.Register(() => executionState.Signal.TryResetToIdle());
await using var cancellationRegistration = cancellationToken.Register(
static state => Unsafe.As<AsyncAutoResetEvent>(state)!.TryResetToIdle(),
executionState.Signal);

// For mutations, we fill the backlog with all nodes from the operation plan just like for queries.
executionState.FillBacklog(plan);
Expand Down Expand Up @@ -228,7 +232,8 @@ private static async IAsyncEnumerable<OperationResult> CreateSubscriptionEnumera
var stream = subscriptionResult.ReadStreamAsync()
.WithCancellation(executionCancellationToken);
await using var cancellationRegistration = executionCancellationToken.Register(
() => executionState.Signal.TryResetToIdle());
static state => Unsafe.As<AsyncAutoResetEvent>(state)!.TryResetToIdle(),
executionState.Signal);

await foreach (var eventArgs in stream)
{
Expand Down
Loading