Skip to content

Commit

Permalink
fix merge comments
Browse files Browse the repository at this point in the history
Signed-off-by: alex60217101990 <alex6021710@gmail.com>
  • Loading branch information
alex60217101990 committed Jan 10, 2022
1 parent 7c41cef commit 8b7c520
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/scalers/predictkube_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8b7c520

Please sign in to comment.