{{ message }}
Cancel support of operations#3890
Merged
Merged
Conversation
This reverts commit 91f1967.
…to cancel-support-attempt-2
Contributor
This comment was marked as outdated.
This comment was marked as outdated.
…mpt-2 # Conflicts: # src/main/java/graphql/execution/AbstractAsyncExecutionStrategy.java # src/main/java/graphql/execution/AsyncExecutionStrategy.java # src/main/java/graphql/execution/AsyncSerialExecutionStrategy.java # src/main/java/graphql/execution/ExecutionContext.java # src/main/java/graphql/execution/ExecutionStrategy.java # src/main/java/graphql/execution/SubscriptionExecutionStrategy.java # src/test/groovy/graphql/execution/ExecutionContextBuilderTest.groovy
bbakerman
commented
Apr 9, 2025
| @Nullable | ||
| private volatile ExecutionId executionId; | ||
|
|
||
| private final AtomicInteger isRunning = new AtomicInteger(0); |
bbakerman
commented
Apr 9, 2025
|
|
||
| private final AtomicInteger isRunning = new AtomicInteger(0); | ||
|
|
||
| @VisibleForTesting |
Member
Author
There was a problem hiding this comment.
killed this - tests now create a valid one
bbakerman
commented
Apr 9, 2025
| } | ||
| //noinspection DataFlowIssue | ||
| return fn.apply(t, throwable); | ||
| }); |
Member
Author
There was a problem hiding this comment.
idea was giving it a yellow line
bbakerman
commented
Apr 9, 2025
| this.executionId = executionId; | ||
| public void updateExecutionInput(ExecutionInput executionInput) { | ||
| this.executionInput = executionInput; | ||
| this.executionId = executionInput.getExecutionId(); |
Member
Author
There was a problem hiding this comment.
we now can change the execution input
bbakerman
commented
Apr 9, 2025
| void throwIfCancelled() throws AbortExecutionException { | ||
| engineRunningState.throwIfCancelled(); | ||
| } | ||
| } No newline at end of file |
Member
Author
There was a problem hiding this comment.
These are just helper methods to make it nicer inside the ExecutionStrategies
bbakerman
commented
Apr 9, 2025
|
|
||
| private BiConsumer<List<Object>, Throwable> buildFieldValueMap(List<String> fieldNames, CompletableFuture<Map<String, Object>> overallResult, ExecutionContext executionContext) { | ||
| return (List<Object> results, Throwable exception) -> { | ||
| exception = executionContext.possibleCancellation(exception); |
Member
Author
There was a problem hiding this comment.
This does a trick - if the Throwable is already set - leave it set - otherwise check if we are cancelled and make the throwable be that
bbakerman
commented
Apr 9, 2025
Member
Author
There was a problem hiding this comment.
Made it a valid EngineRunningState not a test one
…mpt-2 # Conflicts: # src/main/java/graphql/execution/EngineRunningObserver.java
…to cancel-support-attempt-2
…mpt-2 # Conflicts: # src/main/java/graphql/execution/ExecutionContext.java
…mpt-2 # Conflicts: # src/test/groovy/graphql/execution/SubscriptionExecutionStrategyTest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is related to #3879
This is the second attempt at operation cancellation.
This now uses the new
graphql.EngineRunningStateas the place to hold the ExecutionInput an check if its cancelled.The execution engine code now calls into to check
There are some helpers on execution context as well for