[ 
https://issues.apache.org/jira/browse/SCB-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16363312#comment-16363312
 ] 

ASF GitHub Bot commented on SCB-336:
------------------------------------

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:
   是否可以将黑白名单过滤分成2个函数,减少for的圈复杂度

----------------------------------------------------------------
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


> Can not filter instances with service tags
> ------------------------------------------
>
>                 Key: SCB-336
>                 URL: https://issues.apache.org/jira/browse/SCB-336
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Service-Center
>            Reporter: little-cui
>            Assignee: little-cui
>            Priority: Major
>             Fix For: service-center-1.0.0-m2
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to