raftexample: use Rlock instead of Lock in getsnapshot
@@ -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)
}
