Skip to content

Commit

Permalink
make a copy of services for handle method
Browse files Browse the repository at this point in the history
  • Loading branch information
Asim committed Aug 24, 2016
1 parent 0afaaee commit 71d64f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion registry/consul_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 71d64f9

Please sign in to comment.