little-cui commented on a change in pull request #279: SCB-336 1.add ut about 
find instance with tag 2.optimize find api
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/279#discussion_r168052616
 
 

 ##########
 File path: server/service/util/rule_util.go
 ##########
 @@ -162,53 +156,54 @@ func AllowAcrossDimension(ctx context.Context, 
providerService *pb.MicroService,
        return nil
 }
 
-func MatchRules(rules []*pb.ServiceRule, service *pb.MicroService, serviceTags 
map[string]string) *scerr.Error {
-       if service == nil {
-               return scerr.NewError(scerr.ErrInvalidParams, "service is nil")
+func MatchRules(rulesOfProvider []*pb.ServiceRule, consumer *pb.MicroService, 
tagsOfConsumer map[string]string) *scerr.Error {
+       if consumer == nil {
+               return scerr.NewError(scerr.ErrInvalidParams, "consumer is nil")
        }
+       consumerId := consumer.ServiceId
+       v := reflect.Indirect(reflect.ValueOf(consumer))
 
-       v := reflect.Indirect(reflect.ValueOf(service))
-
-       hasWhite := false
-       for _, rule := range rules {
+       isWhite := false
 
 Review comment:
   can divide this logic into two method and reduce circle complexity

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to