File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/HotChocolate/Fusion/test/Core.Tests Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1286,6 +1286,7 @@ ... on User {
1286
1286
public async Task Hot_Reload ( )
1287
1287
{
1288
1288
// arrange
1289
+ var executorUpdatedResetEvent = new ManualResetEventSlim ( false ) ;
1289
1290
using var demoProject = await DemoProject . CreateAsync ( ) ;
1290
1291
1291
1292
var fusionGraph =
@@ -1319,6 +1320,18 @@ public async Task Hot_Reload()
1319
1320
1320
1321
var executorResolver = services . GetRequiredService < IRequestExecutorResolver > ( ) ;
1321
1322
var executorProxy = new RequestExecutorProxy ( executorResolver , Schema . DefaultName ) ;
1323
+ var isFirstUpdate = true ;
1324
+ executorProxy . ExecutorUpdated += ( sender , args ) =>
1325
+ {
1326
+ if ( isFirstUpdate )
1327
+ {
1328
+ isFirstUpdate = false ;
1329
+ }
1330
+ else
1331
+ {
1332
+ executorUpdatedResetEvent . Set ( ) ;
1333
+ }
1334
+ } ;
1322
1335
1323
1336
var result = await executorProxy . ExecuteAsync (
1324
1337
OperationRequestBuilder
@@ -1342,6 +1355,8 @@ public async Task Hot_Reload()
1342
1355
config . SetConfiguration (
1343
1356
new GatewayConfiguration (
1344
1357
SchemaFormatter . FormatAsDocument ( fusionGraph ) ) ) ;
1358
+ using var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 5 ) ) ;
1359
+ executorUpdatedResetEvent . Wait ( cts . Token ) ;
1345
1360
1346
1361
result = await executorProxy . ExecuteAsync (
1347
1362
OperationRequestBuilder
You can’t perform that action at this time.
0 commit comments