Browse Source

Merge pull request #10105 from johncming/master

bugfix: use Rlock instead of Lock in raftexample.
Xiang Li 7 years ago
parent
commit
f32bc50765
1 changed files with 2 additions and 2 deletions
  1. 2 2
      contrib/raftexample/kvstore.go

+ 2 - 2
contrib/raftexample/kvstore.go

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