Skip to content

Commit b831e21

Browse files
committed
Fixed deferred support to have proper Instrumentation - fixed bugs
1 parent 890ddb3 commit b831e21

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

src/main/java/graphql/execution/incremental/DeferredExecutionSupport.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import graphql.execution.instrumentation.parameters.InstrumentationFieldParameters;
1919
import graphql.incremental.IncrementalPayload;
2020
import graphql.util.FpKit;
21-
import org.jetbrains.annotations.NotNull;
21+
import org.jspecify.annotations.NonNull;
2222

2323
import java.util.Collections;
2424
import java.util.HashMap;
@@ -162,8 +162,6 @@ private Supplier<CompletableFuture<DeferredFragmentCall.FieldWithExecutionResult
162162
}
163163
);
164164

165-
166-
167165
// todo: handle cached computations
168166
return dfCache.computeIfAbsent(
169167
currentField.getResultKey(),
@@ -174,7 +172,7 @@ private Supplier<CompletableFuture<DeferredFragmentCall.FieldWithExecutionResult
174172
);
175173
}
176174

177-
@NotNull
175+
@NonNull
178176
private Supplier<CompletableFuture<DeferredFragmentCall.FieldWithExecutionResult>> resolveDeferredFieldValue(MergedField currentField, ExecutionContext executionContext, ExecutionStrategyParameters executionStrategyParameters) {
179177
return () -> {
180178

src/test/groovy/graphql/execution/instrumentation/InstrumentationTest.groovy

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,7 @@ class InstrumentationTest extends Specification {
506506
def query = """
507507
{
508508
hero {
509-
... @defer(label: "id") {
510-
id
511-
}
509+
id
512510
... @defer(label: "name") {
513511
name
514512
}
@@ -551,6 +549,13 @@ class InstrumentationTest extends Specification {
551549
"end:fetch-hero",
552550
"start:complete-hero",
553551
"start:execute-object",
552+
"start:field-id",
553+
"start:fetch-id",
554+
"end:fetch-id",
555+
"start:complete-id",
556+
"end:complete-id",
557+
"end:field-id",
558+
554559
"end:execute-object",
555560
"end:complete-hero",
556561
"end:field-hero",
@@ -559,14 +564,6 @@ class InstrumentationTest extends Specification {
559564
"end:execution",
560565
//
561566
// the deferred field resolving now happens after the operation has come back
562-
"start:deferred-field-id",
563-
"start:field-id",
564-
"start:fetch-id",
565-
"end:fetch-id",
566-
"start:complete-id",
567-
"end:complete-id",
568-
"end:field-id",
569-
"end:deferred-field-id",
570567
"start:deferred-field-name",
571568
"start:field-name",
572569
"start:fetch-name",

0 commit comments

Comments
 (0)