浏览代码

store: use Rlock when GET

mqliang 9 年之前
父节点
当前提交
ffd3cb78d4
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      store/store.go

+ 2 - 2
store/store.go

@@ -119,8 +119,8 @@ func (s *store) Index() uint64 {
 func (s *store) Get(nodePath string, recursive, sorted bool) (*Event, error) {
 	var err *etcdErr.Error
 
-	s.worldLock.Lock()
-	defer s.worldLock.Unlock()
+	s.worldLock.RLock()
+	defer s.worldLock.RUnlock()
 
 	defer func() {
 		if err == nil {