File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,21 @@ func unixHealthCheck() *cobra.Command {
4848 return healthErr
4949 }
5050
51- log .Info ("received status: %s" , res .Status .String ())
52- switch res .Status {
53- case grpc_health_v1 .HealthCheckResponse_SERVING :
51+ if res .Status == grpc_health_v1 .HealthCheckResponse_SERVING {
52+ log .Trace ("healthcheck response OK" )
5453 os .Exit (0 )
54+ return nil
55+ }
56+
57+ err := fmt .Errorf ("unexpected healthcheck response: %v" , res .Status )
58+ log .Error (err , "while processing healthcheck response" )
59+
60+ // exit code 1 is returned when we exit from the function with an error
61+ switch res .Status {
5562 case grpc_health_v1 .HealthCheckResponse_UNKNOWN :
56- os .Exit (1 )
57- case grpc_health_v1 .HealthCheckResponse_NOT_SERVING :
5863 os .Exit (2 )
64+ case grpc_health_v1 .HealthCheckResponse_NOT_SERVING :
65+ os .Exit (3 )
5966 default :
6067 os .Exit (125 )
6168 }
You can’t perform that action at this time.
0 commit comments