Quellcode durchsuchen

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>
(cherry picked from commit 5ed84009b33642ca1f1eac8b99001842d93e2494)
David Calavera vor 10 Jahren
Ursprung
Commit
2f7145b1c5
1 geänderte Dateien mit 0 neuen und 2 gelöschten Zeilen
  1. 0 2
      pkg/truncindex/truncindex.go

+ 0 - 2
pkg/truncindex/truncindex.go

@@ -111,8 +111,6 @@ func (idx *TruncIndex) Get(s string) (string, error) {
 
 
 // Iterates over all stored IDs, and passes each of them to the given handler
 // 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