nomad: use a read-only lock

This commit is contained in:
Ryan Uber 2015-11-23 21:49:03 -08:00
parent ad6b55a37a
commit 39b2c3a07b
1 changed files with 2 additions and 2 deletions

View File

@ -617,8 +617,8 @@ func (s *Server) State() *state.StateStore {
// Regions returns the known regions in the cluster.
func (s *Server) Regions() []string {
s.peerLock.Lock()
defer s.peerLock.Unlock()
s.peerLock.RLock()
defer s.peerLock.RUnlock()
regions := make([]string, 0, len(s.peers))
for region, _ := range s.peers {