raftexample: use Rlock instead of Lock in getsnapshot

release-3.4
caoming 2018-09-19 09:29:48 +08:00
parent ab544f2dde
commit dd6e579b84
1 changed files with 2 additions and 2 deletions

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)
}