@@ -24,7 +24,8 @@ private OperationPlan BuildExecutionPlan(
2424 OperationDefinitionNode operationDefinition ,
2525 ImmutableList < PlanStep > planSteps ,
2626 int searchSpace ,
27- int expandedNodes )
27+ int expandedNodes ,
28+ CancellationToken cancellationToken )
2829 {
2930 if ( operation . IsIntrospectionOnly ( ) )
3031 {
@@ -44,7 +45,7 @@ private OperationPlan BuildExecutionPlan(
4445
4546 planSteps = TransformPlanSteps ( planSteps , operationDefinition ) ;
4647 IndexDependencies ( planSteps , ctx ) ;
47- BuildExecutionNodes ( planSteps , ctx , _schema , hasVariables ) ;
48+ BuildExecutionNodes ( planSteps , ctx , _schema , hasVariables , cancellationToken ) ;
4849 MergeAndBatchOperations ( ctx , _options . EnableRequestGrouping , _options . MergePolicy ) ;
4950 WireExecutionDependencies ( ctx ) ;
5051
@@ -244,14 +245,17 @@ private static void BuildExecutionNodes(
244245 ImmutableList < PlanStep > planSteps ,
245246 ExecutionPlanBuildContext ctx ,
246247 ISchemaDefinition schema ,
247- bool hasVariables )
248+ bool hasVariables ,
249+ CancellationToken cancellationToken )
248250 {
249251 var requiresUpload = schema . Types . TryGetType ( UploadScalarName , out var uploadType ) && uploadType . IsScalarType ( ) ;
250252 var readySteps = planSteps . Where ( t => ! ctx . DependenciesByStepId . ContainsKey ( t . Id ) ) . ToList ( ) ;
251253 var variableBuffer = hasVariables ? new List < string > ( ) : null ;
252254
253255 while ( ctx . ProcessedStepIds . Count < planSteps . Count )
254256 {
257+ cancellationToken . ThrowIfCancellationRequested ( ) ;
258+
255259 foreach ( var step in readySteps )
256260 {
257261 if ( ! ctx . ProcessedStepIds . Add ( step . Id ) )
0 commit comments