Skip to content

Commit

Permalink
Remove check on not seen txs in liveness health check
Browse files Browse the repository at this point in the history
  • Loading branch information
boecklim committed Aug 19, 2024
1 parent b9ffd18 commit d141e15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
16 changes: 0 additions & 16 deletions internal/metamorph/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ func (s *Server) Check(ctx context.Context, req *grpc_health_v1.HealthCheckReque
}, nil
}
case liveness:
notSeenStat := s.processor.GetStatusNotSeen()
if notSeenStat > 0 {
s.logger.Warn("Txs unseen on network", slog.Int64("count", notSeenStat))
return &grpc_health_v1.HealthCheckResponse{
Status: grpc_health_v1.HealthCheckResponse_NOT_SERVING,
}, nil
}

return &grpc_health_v1.HealthCheckResponse{
Status: grpc_health_v1.HealthCheckResponse_SERVING,
}, nil
Expand Down Expand Up @@ -78,14 +70,6 @@ func (s *Server) Watch(req *grpc_health_v1.HealthCheckRequest, server grpc_healt
})
}
case liveness:
notSeenStat := s.processor.GetStatusNotSeen()
if notSeenStat > 0 {
s.logger.Warn("Txs unseen on network", slog.Int64("count", notSeenStat))
return server.Send(&grpc_health_v1.HealthCheckResponse{
Status: grpc_health_v1.HealthCheckResponse_NOT_SERVING,
})
}

return server.Send(&grpc_health_v1.HealthCheckResponse{
Status: grpc_health_v1.HealthCheckResponse_SERVING,
})
Expand Down
28 changes: 4 additions & 24 deletions internal/metamorph/health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,15 @@ func TestCheck(t *testing.T) {
service string
pingErr error
processorHealthErr error
statusNotSeen int64

expectedStatus grpc_health_v1.HealthCheckResponse_ServingStatus
}{
{
name: "liveness - healthy",
service: "liveness",
statusNotSeen: 0,
name: "liveness - healthy",
service: "liveness",

expectedStatus: grpc_health_v1.HealthCheckResponse_SERVING,
},
{
name: "liveness - unhealthy",
service: "liveness",
statusNotSeen: 1,

expectedStatus: grpc_health_v1.HealthCheckResponse_NOT_SERVING,
},
{
name: "readiness - healthy",
service: "readiness",
Expand Down Expand Up @@ -74,7 +65,6 @@ func TestCheck(t *testing.T) {
HealthFunc: func() error {
return tc.processorHealthErr
},
GetStatusNotSeenFunc: func() int64 { return tc.statusNotSeen },
}

server := metamorph.NewServer(metamorphStore, processor)
Expand All @@ -93,24 +83,15 @@ func TestWatch(t *testing.T) {
service string
pingErr error
processorHealthErr error
statusNotSeen int64

expectedStatus grpc_health_v1.HealthCheckResponse_ServingStatus
}{
{
name: "liveness - healthy",
service: "liveness",
statusNotSeen: 0,
name: "liveness - healthy",
service: "liveness",

expectedStatus: grpc_health_v1.HealthCheckResponse_SERVING,
},
{
name: "liveness - unhealthy",
service: "liveness",
statusNotSeen: 1,

expectedStatus: grpc_health_v1.HealthCheckResponse_NOT_SERVING,
},
{
name: "readiness - healty",
service: "readiness",
Expand Down Expand Up @@ -149,7 +130,6 @@ func TestWatch(t *testing.T) {
HealthFunc: func() error {
return tc.processorHealthErr
},
GetStatusNotSeenFunc: func() int64 { return tc.statusNotSeen },
}

server := metamorph.NewServer(metamorphStore, processor)
Expand Down

0 comments on commit d141e15

Please sign in to comment.