remove stopwatch from health check
This commit is contained in:
parent
07c669a047
commit
99867ff168
1 changed files with 0 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static System.Diagnostics.Stopwatch;
|
|
||||||
using cartservice.interfaces;
|
using cartservice.interfaces;
|
||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
using Grpc.Health.V1;
|
using Grpc.Health.V1;
|
||||||
|
@ -15,13 +14,9 @@ namespace cartservice {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context){
|
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context){
|
||||||
var watch = StartNew();
|
|
||||||
var result = Task.FromResult(new HealthCheckResponse {
|
var result = Task.FromResult(new HealthCheckResponse {
|
||||||
Status = dependency.Ping() ? HealthCheckResponse.Types.ServingStatus.Serving : HealthCheckResponse.Types.ServingStatus.NotServing
|
Status = dependency.Ping() ? HealthCheckResponse.Types.ServingStatus.Serving : HealthCheckResponse.Types.ServingStatus.NotServing
|
||||||
});
|
});
|
||||||
watch.Stop();
|
|
||||||
var elapsedMs = watch.ElapsedMilliseconds;
|
|
||||||
Console.WriteLine ("✅ Health Check took " + elapsedMs + "ms");
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue