File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
GraphQLParser.Tests/Visitors Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,13 @@ public void ASTVisitor_Should_Throw_On_Unknown_Node()
33
33
}
34
34
35
35
[ Fact ]
36
- public void ASTVisitor_Should_Respect_CancellationToken ( )
36
+ public void ASTVisitor_Should_Pass_CancellationToken ( )
37
37
{
38
38
var document = "scalar JSON" . Parse ( ) ;
39
39
var visitor = new MyVisitor ( ) ;
40
40
using var cts = new CancellationTokenSource ( 500 ) ;
41
41
var context = new Context { CancellationToken = cts . Token } ;
42
+ context . CancellationToken . ThrowIfCancellationRequested ( ) ;
42
43
43
44
Should . Throw < OperationCanceledException > ( ( ) => visitor . VisitAsync ( document , context ) . GetAwaiter ( ) . GetResult ( ) ) ;
44
45
}
@@ -48,6 +49,7 @@ private class MyVisitor : ASTVisitor<Context>
48
49
protected override async ValueTask VisitScalarTypeDefinitionAsync ( GraphQLScalarTypeDefinition scalarTypeDefinition , Context context )
49
50
{
50
51
await Task . Delay ( 700 ) ;
52
+ context . CancellationToken . ThrowIfCancellationRequested ( ) ;
51
53
await base . VisitScalarTypeDefinitionAsync ( scalarTypeDefinition , context ) ;
52
54
}
53
55
}
Original file line number Diff line number Diff line change @@ -595,8 +595,6 @@ protected virtual async ValueTask VisitInputObjectTypeExtensionAsync(GraphQLInpu
595
595
/// <param name="context">Context passed into all INodeVisitor.VisitXXX methods.</param>
596
596
public virtual ValueTask VisitAsync ( ASTNode ? node , TContext context )
597
597
{
598
- context . CancellationToken . ThrowIfCancellationRequested ( ) ;
599
-
600
598
return node == null
601
599
? default
602
600
: node switch
You can’t perform that action at this time.
0 commit comments