Fix some mapping issues while we're at it
This commit is contained in:
parent
9d7bd3f424
commit
e2855c4bc2
@ -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]
|
||||||
|
@ -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}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user