Skip to content

Commit

Permalink
close all iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgoAxel committed Apr 3, 2023
1 parent 7712bea commit 01f1cfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ledger/store/trackerdb/generickv/accounts_ext_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (r *accountsReader) LookupOnlineAccountDataByAddress(addr basics.Address) (
high := onlineAccountOnlyPartialKey(addr)
high[len(high)-1] += 1
iter := r.kvr.NewIter(low, high, true)
defer iter.Close()

if iter.Next() {
// key is <prefix>-<addr>-<rnd> = <content>
Expand Down Expand Up @@ -185,6 +186,7 @@ func (r *accountsReader) AccountsOnlineTop(rnd basics.Round, offset uint64, n ui
high[len(high)-1] += 1
// reverse order iterator to get high-to-low
iter := r.kvr.NewIter(low, high, true)
defer iter.Close()

var value []byte

Expand Down Expand Up @@ -301,6 +303,7 @@ func (r *accountsReader) OnlineAccountsAll(maxAccounts uint64) (data []trackerdb
low := []byte(kvPrefixOnlineAccount + "-")
high := []byte(kvPrefixOnlineAccount + ".")
iter := r.kvr.NewIter(low, high, false)
defer iter.Close()

var value []byte
var updround uint64
Expand Down
1 change: 1 addition & 0 deletions ledger/store/trackerdb/generickv/onlineaccounts_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func (r *accountsReader) LookupOnlineHistory(addr basics.Address) (result []trac
high := onlineAccountOnlyPartialKey(addr)
high[len(high)-1] += 1
iter := r.kvr.NewIter(low, high, false)
defer iter.Close()

var value []byte
var updround uint64
Expand Down
1 change: 1 addition & 0 deletions ledger/store/trackerdb/testsuite/badum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestThis(t *testing.T) {

// acccounts
iter := db.NewIter([]byte{0x00}, []byte{0xFF}, false)
defer iter.Close()
for iter.Next() {
key := iter.Key()
skey := string(key)
Expand Down

0 comments on commit 01f1cfa

Please sign in to comment.