mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 23:58:17 +01:00
LevelDB backend: Recycle iterator in all keys fetch.
This commit is contained in:
parent
ecf00b45f5
commit
120531ed78
@ -169,7 +169,6 @@ func (ldbs *LevelDBSession) AllKeys(hash []byte) (keys chan []byte, n int, err e
|
|||||||
ldbs.backend.mutex.RUnlock()
|
ldbs.backend.mutex.RUnlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
it.Close()
|
|
||||||
|
|
||||||
keys = make(chan []byte)
|
keys = make(chan []byte)
|
||||||
|
|
||||||
@ -177,7 +176,6 @@ func (ldbs *LevelDBSession) AllKeys(hash []byte) (keys chan []byte, n int, err e
|
|||||||
ldbs.backend.mutex.RUnlock()
|
ldbs.backend.mutex.RUnlock()
|
||||||
defer ro.Close()
|
defer ro.Close()
|
||||||
defer close(keys)
|
defer close(keys)
|
||||||
it := ldbs.backend.db.NewIterator(ro)
|
|
||||||
defer it.Close()
|
defer it.Close()
|
||||||
it.SeekToFirst()
|
it.SeekToFirst()
|
||||||
for ; it.Valid(); it.Next() {
|
for ; it.Valid(); it.Next() {
|
||||||
|
Loading…
Reference in New Issue
Block a user