Skip to content

Commit

Permalink
fix issue #711: Nacos registry doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
localvar committed Jul 25, 2022
1 parent 085130a commit e617a11
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/filters/proxy/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,22 @@ func (sp *ServerPool) useService(instances map[string]*serviceregistry.ServiceIn
servers := make([]*Server, 0)

for _, instance := range instances {
// default to true in case of sp.spec.ServerTags is empty
match := true

for _, tag := range sp.spec.ServerTags {
if stringtool.StrInSlice(tag, instance.Tags) {
servers = append(servers, &Server{
URL: instance.URL(),
Tags: instance.Tags,
Weight: instance.Weight,
})
if match = stringtool.StrInSlice(tag, instance.Tags); match {
break
}
}

if match {
servers = append(servers, &Server{
URL: instance.URL(),
Tags: instance.Tags,
Weight: instance.Weight,
})
}
}

if len(servers) == 0 {
Expand Down

0 comments on commit e617a11

Please sign in to comment.