make a copy of services
This commit is contained in:
parent
321358ae1f
commit
0afaaeec8d
@ -100,7 +100,11 @@ func (cw *consulWatcher) serviceHandler(idx uint64, data interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cw.RLock()
|
cw.RLock()
|
||||||
rservices := cw.services
|
// make a copy
|
||||||
|
rservices := make(map[string][]*Service)
|
||||||
|
for k, v := range cw.services {
|
||||||
|
rservices[k] = v
|
||||||
|
}
|
||||||
cw.RUnlock()
|
cw.RUnlock()
|
||||||
|
|
||||||
var newServices []*Service
|
var newServices []*Service
|
||||||
|
Loading…
Reference in New Issue
Block a user