mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raftexample: use Rlock instead of Lock in getsnapshot
This commit is contained in:
parent
ab544f2dde
commit
dd6e579b84
@ -95,8 +95,8 @@ func (s *kvstore) readCommits(commitC <-chan *string, errorC <-chan error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *kvstore) getSnapshot() ([]byte, error) {
|
func (s *kvstore) getSnapshot() ([]byte, error) {
|
||||||
s.mu.Lock()
|
s.mu.RLock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.RUnlock()
|
||||||
return json.Marshal(s.kvStore)
|
return json.Marshal(s.kvStore)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user