cartservice: fix health Check() method signature (#57)
- Use the method provided in HealthBase - Use the same version of GrpcHealth as Grpc core. Fixes #50.
This commit is contained in:
parent
c61a8aea4c
commit
be65dd1fcd
2 changed files with 7 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using cartservice.interfaces;
|
using cartservice.interfaces;
|
||||||
|
using Grpc.Core;
|
||||||
using Grpc.Health.V1;
|
using Grpc.Health.V1;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using static Grpc.Health.V1.Health;
|
using static Grpc.Health.V1.Health;
|
||||||
|
@ -11,12 +13,12 @@ namespace cartservice {
|
||||||
this.dependency = dependency;
|
this.dependency = dependency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HealthCheckResponse Check (HealthCheckRequest request) {
|
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context){
|
||||||
Console.WriteLine ("Checking CartService Health");
|
Console.WriteLine ("Checking CartService Health");
|
||||||
|
|
||||||
return new HealthCheckResponse {
|
return 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
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
|
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
|
||||||
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.1" />
|
<PackageReference Include="Google.Protobuf.Tools" Version="3.5.1" />
|
||||||
<PackageReference Include="grpc" Version="1.12.0" />
|
<PackageReference Include="grpc" Version="1.12.0" />
|
||||||
<PackageReference Include="Grpc.HealthCheck" Version="1.15.0" />
|
<PackageReference Include="Grpc.HealthCheck" Version="1.12.0" />
|
||||||
<PackageReference Include="grpc.tools" Version="1.12.0" />
|
<PackageReference Include="grpc.tools" Version="1.12.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||||
|
|
Loading…
Reference in a new issue