mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
Merge pull request #541 from milosgajdos83/gossip-del-service-revert
Reverts c0a628d
This commit is contained in:
commit
1277f2478d
@ -115,20 +115,27 @@ func delNodes(old, del []*registry.Node) []*registry.Node {
|
||||
|
||||
func delServices(old, del []*registry.Service) []*registry.Service {
|
||||
var services []*registry.Service
|
||||
|
||||
for _, o := range old {
|
||||
srv := new(registry.Service)
|
||||
*srv = *o
|
||||
|
||||
var rem bool
|
||||
|
||||
for _, s := range del {
|
||||
if o.Version == s.Version {
|
||||
s.Nodes = delNodes(s.Nodes, o.Nodes)
|
||||
if len(s.Nodes) == 0 {
|
||||
if srv.Version == s.Version {
|
||||
srv.Nodes = delNodes(srv.Nodes, s.Nodes)
|
||||
|
||||
if len(srv.Nodes) == 0 {
|
||||
rem = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !rem {
|
||||
services = append(services, o)
|
||||
services = append(services, srv)
|
||||
}
|
||||
}
|
||||
|
||||
return services
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user