Merge pull request #1014 from milosgajdos83/memreg-race

Fix memory registry race
This commit is contained in:
Asim Aslam 2019-12-03 16:51:36 +00:00 committed by GitHub
commit 3fbba9f83d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,9 +87,8 @@ func (m *Registry) ttlPrune() {
} }
func (m *Registry) sendEvent(r *registry.Result) { func (m *Registry) sendEvent(r *registry.Result) {
watchers := make([]*Watcher, 0, len(m.watchers))
m.RLock() m.RLock()
watchers := make([]*Watcher, 0, len(m.watchers))
for _, w := range m.watchers { for _, w := range m.watchers {
watchers = append(watchers, w) watchers = append(watchers, w)
} }