Skip to content

Commit

Permalink
grpcdb: close Iterator/ReverseIterator after use (#3424)
Browse files Browse the repository at this point in the history
Fixes #3402
  • Loading branch information
melekes committed Mar 14, 2019
1 parent a59930a commit 7457133
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ Special thanks to external contributors on this release:
- [libs/pubsub] \#951, \#1880 use non-blocking send when dispatching messages [ADR-33](https://github.com/tendermint/tendermint/blob/develop/docs/architecture/adr-033-pubsub.md)
- [p2p] \#3369 do not panic when filter times out
- [cmd] \#3408 Fix `testnet` command's panic when creating non-validator configs (using `--n` flag) (@srmo)
- [libs/db/remotedb/grpcdb] \#3402 Close Iterator/ReverseIterator after use
2 changes: 2 additions & 0 deletions libs/db/remotedb/grpcdb/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func (s *server) SetSync(ctx context.Context, in *protodb.Entity) (*protodb.Noth

func (s *server) Iterator(query *protodb.Entity, dis protodb.DB_IteratorServer) error {
it := s.db.Iterator(query.Start, query.End)
defer it.Close()
return s.handleIterator(it, dis.Send)
}

Expand All @@ -162,6 +163,7 @@ func (s *server) handleIterator(it db.Iterator, sendFunc func(*protodb.Iterator)

func (s *server) ReverseIterator(query *protodb.Entity, dis protodb.DB_ReverseIteratorServer) error {
it := s.db.ReverseIterator(query.Start, query.End)
defer it.Close()
return s.handleIterator(it, dis.Send)
}

Expand Down

0 comments on commit 7457133

Please sign in to comment.