Repository navigation
Deliver parent @defer payloads before nested child @defer payloads - #4568
Open
sahuadarsh0 wants to merge 1 commit into
Open
sahuadarsh0 wants to merge 1 commit into
sahuadarsh0 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Fixes #4567
Root Cause
In
ExecutionStrategy.getAsyncFieldValueInfo, nested@defercalls discovered while resolving a field inside an outer deferred fragment were enqueued intoIncrementalCallStatewithout tracking their parent fragment. When the nested@defercompleted faster than a sibling field of its parent@defer,IncrementalCallStateemitted the child payload before the parent payload (with bothenableEarlyIncrementalFieldExecutionenabled and disabled).Changes
AlternativeCallContextonDeferredFragmentCall.parameters.getAlternativeCallContext()when enqueuing deferred calls inExecutionStrategy.getAsyncFieldValueInfo.IncrementalCallStateunderpublisherLock. If a child call completes while its parent has not yet been emitted, buffer its payload and flush ready descendants in parent-before-child order as soon as the parent is offered to the publisher (preserving exacthasNextcalculation and keeping unrelated sibling defers unblocked).Testing
DeferExecutionSupportIntegrationTestcovering 2-level and 3-level nested@deferordering with faster inner resolvers under bothENABLE_EAGER_DEFER_START = falseandtrue.IncrementalCallStateDeferTestverifying parent-before-child ordering, unblocked sibling delivery, and unregistered parent contexts (e.g., subscriptions)../gradlew test --tests "graphql.execution.incremental.*" --tests "graphql.execution.instrumentation.dataloader.DeferWithDataLoaderTest"(127 tests passed)./gradlew test --tests "graphql.execution.incremental.*" --tests "graphql.execution.AsyncExecutionStrategyTest" --tests "graphql.execution.SubscriptionExecutionStrategyTest"(80 tests passed)