-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (19 loc) · 827 Bytes
/
Copy pathProgram.cs
File metadata and controls
25 lines (19 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using HotChocolate.Execution;
using Microsoft.Extensions.DependencyInjection;
using Repro;
const string Query = "{ items { reason { text } } }";
foreach (var itemCount in (int[])[1, 2]) {
var provider = new ServiceCollection()
.AddGraphQL()
.AddReproTypes()
.Services
.AddSingleton(new ItemCount(itemCount))
.BuildServiceProvider();
var executor = await provider.GetRequiredService<IRequestExecutorProvider>().GetExecutorAsync();
var sw = System.Diagnostics.Stopwatch.StartNew();
var run = Task.Run(() => executor.ExecuteAsync(Query));
Console.WriteLine(await Task.WhenAny(run, Task.Delay(5000)) == run
? $"items={itemCount}: finished after {sw.ElapsedMilliseconds} ms"
: $"items={itemCount}: STUCK. No result after 5s");
}
Environment.Exit(0);