소스 검색

Remove read index that causes dead lock.

Let the iterator to lock the index when it needs it.

Signed-off-by: David Calavera <david.calavera@gmail.com>
David Calavera 10 년 전
부모
커밋
5ed84009b3
1개의 변경된 파일0개의 추가작업 그리고 2개의 파일을 삭제
  1. 0 2
      pkg/truncindex/truncindex.go

+ 0 - 2
pkg/truncindex/truncindex.go

@@ -121,8 +121,6 @@ func (idx *TruncIndex) Get(s string) (string, error) {
 
 
 // Iterate iterates over all stored IDs, and passes each of them to the given handler.
 // Iterate iterates over all stored IDs, and passes each of them to the given handler.
 func (idx *TruncIndex) Iterate(handler func(id string)) {
 func (idx *TruncIndex) Iterate(handler func(id string)) {
-	idx.RLock()
-	defer idx.RUnlock()
 	idx.trie.Visit(func(prefix patricia.Prefix, item patricia.Item) error {
 	idx.trie.Visit(func(prefix patricia.Prefix, item patricia.Item) error {
 		handler(string(prefix))
 		handler(string(prefix))
 		return nil
 		return nil