Skip to content

Commit f417457

Browse files
authored
Fix benchmarks by writing to console on application start (#584)
1 parent 5c8a13b commit f417457

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

perf/benchmarkapps/GrpcAspNetCoreServer/Startup.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
#endregion
1818

19+
using System;
1920
using System.IO;
2021
using System.Text;
2122
using Grpc.Testing;
2223
using Microsoft.AspNetCore.Builder;
2324
using Microsoft.AspNetCore.Http;
2425
using Microsoft.Extensions.DependencyInjection;
26+
using Microsoft.Extensions.Hosting;
2527
using Newtonsoft.Json;
2628

2729
namespace GrpcAspNetCoreServer
@@ -34,8 +36,11 @@ public void ConfigureServices(IServiceCollection services)
3436
services.AddControllers();
3537
}
3638

37-
public void Configure(IApplicationBuilder app)
39+
public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime)
3840
{
41+
// Required to notify performance infrastructure that it can begin benchmarks
42+
applicationLifetime.ApplicationStarted.Register(() => Console.WriteLine("Application started."));
43+
3944
app.UseRouting();
4045
app.UseEndpoints(endpoints =>
4146
{

0 commit comments

Comments
 (0)