Conversation
Test Results 313 files ±0 313 suites ±0 48s ⏱️ -1s Results for commit bd4a098. ± Comparison against base commit 5a03541. This pull request removes 150 and adds 130 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
|
This should be combined with #3876 |
…ncellation-of-request # Conflicts: # src/main/java/graphql/execution/AsyncExecutionStrategy.java # src/main/java/graphql/execution/AsyncSerialExecutionStrategy.java # src/main/java/graphql/execution/ExecutionStrategy.java # src/main/java/graphql/execution/SubscriptionExecutionStrategy.java
…uest # Conflicts: # src/main/java/graphql/execution/ExecutionContext.java # src/main/java/graphql/execution/ExecutionStrategy.java
|
|
||
| // hidden on purpose | ||
| private Builder transfer(GraphQLContext graphQLContext) { | ||
| private Builder internalTransferContext(GraphQLContext graphQLContext) { |
There was a problem hiding this comment.
I can rename because its private method. This is a transferring of the context to a new instance
| private PreparsedDocumentEntry parseAndValidate(AtomicReference<ExecutionInput> executionInputRef, GraphQLSchema graphQLSchema, InstrumentationState instrumentationState) { | ||
|
|
||
| ExecutionInput executionInput = executionInputRef.get(); | ||
| String query = executionInput.getQuery(); |
There was a problem hiding this comment.
never used. Grey code. took the opportunity to remove it
|
|
||
| protected BiConsumer<List<Object>, Throwable> handleResults(ExecutionContext executionContext, List<String> fieldNames, CompletableFuture<ExecutionResult> overallResult) { | ||
| return (List<Object> results, Throwable exception) -> executionContext.run(() -> { | ||
| return (List<Object> results, Throwable exception) -> executionContext.run(exception, () -> { |
There was a problem hiding this comment.
whenever we call run here we need to respect if an exception was thrown on the inside when we check if we are cancelled.
There is not point throwing a "cancelled" exception if we are already in exception
| * @param executionId the id of the current execution | ||
| * @param graphQLContext the graphql context | ||
| */ | ||
| void runningStateChanged(ExecutionId executionId, GraphQLContext graphQLContext, RunningState runningState); |
There was a problem hiding this comment.
made i an enum versus a boolean
|
|
||
| public void incrementRunning() { | ||
| if (isRunning.incrementAndGet() == 1 && engineRunningObserver != null) { | ||
| engineRunningObserver.runningStateChanged(executionId, graphQLContext, true); |
There was a problem hiding this comment.
never needed to be public. Never used publically
| checkIsCancelled(throwable); | ||
|
|
||
| if (isRunning.incrementAndGet() == 1) { | ||
| changeOfState(RUNNING); |
There was a problem hiding this comment.
changeOfState encapsulates the null check
| if (isRunning.incrementAndGet() == 1 && engineRunningObserver != null) { | ||
| engineRunningObserver.runningStateChanged(executionId, graphQLContext, true); | ||
| private void incrementRunning(Throwable throwable) { | ||
| checkIsCancelled(throwable); |
There was a problem hiding this comment.
we now check if we are cancelled in a common place
| return executionResult; | ||
| }); | ||
| }); | ||
| })); |
| @NullMarked | ||
| public interface EngineRunningObserver { | ||
|
|
||
| enum RunningState { |
There was a problem hiding this comment.
Can we add started and finished here to make it complete?
There was a problem hiding this comment.
Maybe not .., we have ways to detect that
Addressing #3879
This allows the graphql operation to be co-operatively cancelled. It use the "engine run state" tracking to know when its a good time to cancel and abort