Fix some mapping issues while we're at it

This commit is contained in:
Asim 2016-04-09 22:19:03 +01:00
parent 9d7bd3f424
commit e2855c4bc2
2 changed files with 5 additions and 20 deletions

View File

@ -200,17 +200,10 @@ func (c *consulRegistry) GetService(name string) ([]*Service, error) {
// address is service address // address is service address
address := s.Service.Address address := s.Service.Address
// if we can't get the new type of version // if we can't get the version we bail
// use old the old ways // use old the old ways
if !found { if !found {
// id was set as node continue
id = s.Node.Node
// key was service id
key = s.Service.ID
// version was service id
version = s.Service.ID
// address was address
address = s.Node.Address
} }
svc, ok := serviceMap[key] svc, ok := serviceMap[key]

View File

@ -62,17 +62,9 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
// address is service address // address is service address
address := e.Service.Address address := e.Service.Address
// if we can't get the new type of version // if we can't get the version we bail
// use old the old ways
if !found { if !found {
// id was set as node continue
id = e.Node.Node
// key was service id
key = e.Service.ID
// version was service id
version = e.Service.ID
// address was address
address = e.Node.Address
} }
svc, ok := serviceMap[key] svc, ok := serviceMap[key]
@ -156,7 +148,7 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
for _, old := range rservices[serviceName] { for _, old := range rservices[serviceName] {
// old version does not exist in new version map // old version does not exist in new version map
// kill it with fire! // kill it with fire!
if _, ok := serviceMap[serviceName+old.Version]; !ok { if _, ok := serviceMap[old.Version]; !ok {
cw.next <- &Result{Action: "delete", Service: old} cw.next <- &Result{Action: "delete", Service: old}
} }
} }