make a copy of services

This commit is contained in:
Asim 2016-08-24 18:27:15 +01:00
parent 321358ae1f
commit 0afaaeec8d

View File

@ -100,7 +100,11 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
}
cw.RLock()
rservices := cw.services
// make a copy
rservices := make(map[string][]*Service)
for k, v := range cw.services {
rservices[k] = v
}
cw.RUnlock()
var newServices []*Service