Skip to content

Capture partial results on cancellation#4398

Open
AlexandreCarlton wants to merge 1 commit into
graphql-java:masterfrom
AlexandreCarlton:capture-partial-results-on-cancel
Open

Capture partial results on cancellation#4398
AlexandreCarlton wants to merge 1 commit into
graphql-java:masterfrom
AlexandreCarlton:capture-partial-results-on-cancel

Conversation

@AlexandreCarlton
Copy link
Copy Markdown
Contributor

Web clients can often impose request timeouts. If a GraphQL server takes too long to respond, then nothing is returned. While we can call ExecutionInput.cancel() in order to slide under a web client's timeout, there are no usable results for the client to handle.

This change improves upon this - if we set #capturePartialResultsOnCancel, then calling .cancel will save all the evaluated DataFetcher results so that something potentially usable can be returned to the client.

Full disclosure: almost all of this was generated with Rovo, with a preliminary review from @bbakerman before submitting here.

Web clients can often impose request timeouts. If a GraphQL server takes
too long to respond, then nothing is returned. While we can call
`ExecutionInput.cancel()` in order to slide a web client's timeout,
there are no usable results for the client to use.

This change improves on this - if we set `#capturePartialResultsOnCancel`,
then calling `.cancel` will save all the evaluated `DataFetcher` results
so that something potentially usable can be returned to the client.

Full disclosure: almost all of this was generated with Rovo, with a
preliminary review from Brad before submitting here.
@github-actions
Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5868 (+3 🟢) 5812 (+3 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 17 5868 (+3 🟢) 5811 (+3 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 21 5868 (+3 🟢) 5811 (+3 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 25 5868 (+3 🟢) 5811 (+3 🟢) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 23504 (+12 🟢) 23277 (+12 🟢) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 29725 3160 90.4% -0.1% 🔴
Branches 8755 1561 84.9% -0.2% 🔴
Methods 7929 1211 86.8% ±0.0%

Changed Class Coverage (8 classes)

Class Line Branch Method
g.e.AbstractAsyncExecutionStrategy -0.5% 🔴 -40.9% 🔴 +10.7% 🟢
g.e.Async
$Empty
+3.6% 🟢 ±0.0% +5.4% 🟢
g.e.Async
$Many
-21.9% 🔴 -28.0% 🔴 -3.3% 🔴
g.e.Async
$Single
±0.0% ±0.0% +2.4% 🟢
g.e.AsyncExecutionStrategy ±0.0% -6.3% 🔴 ±0.0%
g.e.Execution +0.8% 🟢 +4.8% 🟢 ±0.0%
g.e.ExecutionStrategy -0.8% 🔴 -2.0% 🔴 ±0.0%
g.GraphQLUnusualConfiguration
$CancellationConfig
+80.0% 🟢 ±0.0% +66.7% 🟢
AbstractAsyncExecutionStrategy — method details
Method Line Branch
handleResultsWithPartialData new 100.0%
completeResultFuture new 100.0%
lambda$handleResultsWithPartialData$0 new 80.0% 55.0%
Async.Many — method details
Method Line Branch
await new 93.3% 83.3%
harvestPartialResults new 90.0% 75.0%
collectAllResults new 0.0% 0.0%
lambda$await$2 new 28.6% 25.0%
lambda$await$1 new 54.5% 50.0%
AsyncExecutionStrategy — method details
Method Line Branch
lambda$execute$0 new 100.0% 92.9%
lambda$execute$0 removed removed
ExecutionStrategy — method details
Method Line Branch
capturePartialResults new 100.0%
completeFieldValueMap new 100.0%
lambda$buildFieldValueMap$0 66.7% (-33.3% 🔴) 70.0% (-30.0% 🔴)
lambda$executeObject$0 new 100.0% 100.0%
lambda$executeObject$0 removed removed

Full HTML report: build artifact jacoco-html-report

Updated: 2026-05-24 12:00:08 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant