mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 17:03:31 +00:00
Gets rid of named return parameters.
This wasn't wrong before but we don't generally use this style in Consul.
This commit is contained in:
parent
b443bd1438
commit
64acd0ade0
@ -52,20 +52,20 @@ func NewGrpcHealthProbe(target string, timeout time.Duration, tlsConfig *tls.Con
|
|||||||
|
|
||||||
// Check if the target of this GrpcHealthProbe is healthy
|
// Check if the target of this GrpcHealthProbe is healthy
|
||||||
// If nil is returned, target is healthy, otherwise target is not healthy
|
// If nil is returned, target is healthy, otherwise target is not healthy
|
||||||
func (probe *GrpcHealthProbe) Check() (err error) {
|
func (probe *GrpcHealthProbe) Check() error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), probe.timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), probe.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
connection, err := grpc.DialContext(ctx, probe.server, probe.dialOptions...)
|
connection, err := grpc.DialContext(ctx, probe.server, probe.dialOptions...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
defer connection.Close()
|
defer connection.Close()
|
||||||
|
|
||||||
client := hv1.NewHealthClient(connection)
|
client := hv1.NewHealthClient(connection)
|
||||||
response, err := client.Check(ctx, probe.request)
|
response, err := client.Check(ctx, probe.request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
if response == nil || (response != nil && response.Status != hv1.HealthCheckResponse_SERVING) {
|
if response == nil || (response != nil && response.Status != hv1.HealthCheckResponse_SERVING) {
|
||||||
return ErrGRPCUnhealthy
|
return ErrGRPCUnhealthy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user