fix #2733: trying to fix CI race

pull/2779/head
David Norton 2015-06-05 20:49:12 -04:00
parent a235b4998d
commit 5f49934a23
1 changed files with 5 additions and 1 deletions

View File

@ -365,7 +365,11 @@ func (s *Store) Ready() <-chan struct{} { return s.ready }
func (s *Store) Err() <-chan error { return s.err } func (s *Store) Err() <-chan error { return s.err }
// IsLeader returns true if the store is currently the leader. // IsLeader returns true if the store is currently the leader.
func (s *Store) IsLeader() bool { return s.raft.State() == raft.Leader } func (s *Store) IsLeader() bool {
s.mu.RLock()
defer s.mu.RUnlock()
return s.raft.State() == raft.Leader
}
// LeaderCh returns a channel that notifies on leadership change. // LeaderCh returns a channel that notifies on leadership change.
// Panics when the store has not been opened yet. // Panics when the store has not been opened yet.