Merge branch 'master' of ssh://github.com/micro/go-micro

This commit is contained in:
Asim Aslam 2019-06-24 14:49:26 +01:00
commit 9a56c4e0b2

View File

@ -115,20 +115,27 @@ func delNodes(old, del []*registry.Node) []*registry.Node {
func delServices(old, del []*registry.Service) []*registry.Service { func delServices(old, del []*registry.Service) []*registry.Service {
var services []*registry.Service var services []*registry.Service
for _, o := range old { for _, o := range old {
srv := new(registry.Service)
*srv = *o
var rem bool var rem bool
for _, s := range del { for _, s := range del {
if o.Version == s.Version { if srv.Version == s.Version {
s.Nodes = delNodes(s.Nodes, o.Nodes) srv.Nodes = delNodes(srv.Nodes, s.Nodes)
if len(s.Nodes) == 0 {
if len(srv.Nodes) == 0 {
rem = true rem = true
break
} }
} }
} }
if !rem { if !rem {
services = append(services, o) services = append(services, srv)
} }
} }
return services return services
} }