Merge pull request #10105 from johncming/master

bugfix: use Rlock instead of Lock in raftexample.
This commit is contained in:
Xiang Li 2018-09-19 15:50:41 -07:00 committed by GitHub
commit f32bc50765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,8 +95,8 @@ func (s *kvstore) readCommits(commitC <-chan *string, errorC <-chan error) {
}
func (s *kvstore) getSnapshot() ([]byte, error) {
s.mu.Lock()
defer s.mu.Unlock()
s.mu.RLock()
defer s.mu.RUnlock()
return json.Marshal(s.kvStore)
}