Increases cartservice health check rpc timeout
This commit is contained in:
parent
13b73067c4
commit
07c669a047
4 changed files with 22 additions and 18 deletions
|
@ -391,7 +391,8 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/cartservice:v0.1.1
|
||||
image: gcr.io/mokeefe/cartservice:august
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 7070
|
||||
env:
|
||||
|
@ -411,12 +412,12 @@ spec:
|
|||
readinessProbe:
|
||||
initialDelaySeconds: 15
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Diagnostics.Stopwatch;
|
||||
using cartservice.interfaces;
|
||||
using Grpc.Core;
|
||||
using Grpc.Health.V1;
|
||||
|
@ -14,11 +15,14 @@ namespace cartservice {
|
|||
}
|
||||
|
||||
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context){
|
||||
Console.WriteLine ("Checking CartService Health");
|
||||
|
||||
return Task.FromResult(new HealthCheckResponse {
|
||||
var watch = StartNew();
|
||||
var result = Task.FromResult(new HealthCheckResponse {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<PackageReference Include="grpc.tools" Version="1.12.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -202,7 +202,6 @@ namespace cartservice.cartstore
|
|||
{
|
||||
try
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(redisConnectionOptions);
|
||||
var cache = redis.GetDatabase();
|
||||
var res = cache.Ping();
|
||||
return res != TimeSpan.Zero;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue