make a copy of services for handle method

This commit is contained in:
Asim 2016-08-24 18:37:11 +01:00
parent 0afaaeec8d
commit 71d64f911f

View File

@ -201,7 +201,11 @@ func (cw *consulWatcher) handle(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()
// remove unknown services from registry