From 8b7c5206b98f9e4a33dedc076a4f30194e94b24c Mon Sep 17 00:00:00 2001 From: alex60217101990 Date: Mon, 10 Jan 2022 12:45:29 +0200 Subject: [PATCH] fix merge comments Signed-off-by: alex60217101990 --- pkg/scalers/predictkube_scaler.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/scalers/predictkube_scaler.go b/pkg/scalers/predictkube_scaler.go index c0cb44863d7..e890353beff 100644 --- a/pkg/scalers/predictkube_scaler.go +++ b/pkg/scalers/predictkube_scaler.go @@ -15,6 +15,7 @@ import ( "github.com/prometheus/common/model" "github.com/xhit/go-str2duration/v2" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" health "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/status" @@ -172,11 +173,15 @@ func (pks *PredictKubeScaler) IsActive(ctx context.Context) (bool, error) { resp, err := pks.healthClient.Check(ctx, &health.HealthCheckRequest{}) - if resp == nil || err != nil { - err = fmt.Errorf("can't connect grpc server: %v, code: %v", err, status.Code(err)) + if resp == nil { + return len(results) > 0, fmt.Errorf("can't connect grpc server: empty server response, code: %v", codes.Unknown) } - return len(results) > 0 && err == nil, err + if err != nil { + return len(results) > 0, fmt.Errorf("can't connect grpc server: %v, code: %v", err, status.Code(err)) + } + + return len(results) > 0, nil } func (pks *PredictKubeScaler) Close(_ context.Context) error {