LevelDB backend: Recycle iterator in all keys fetch.

This commit is contained in:
Sascha L. Teichmann 2014-08-11 17:07:23 +02:00
parent ecf00b45f5
commit 120531ed78

View File

@ -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() {