Skip to content

Commit

Permalink
fix merge comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alex60217101990 committed Jan 10, 2022
1 parent 5a9cea9 commit d73ba47
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 d73ba47

Please sign in to comment.