Skip to content

Commit

Permalink
Merge pull request #83 from irisnet/vincent/remote-db
Browse files Browse the repository at this point in the history
R4R: Close Iterator in RemoteDB
  • Loading branch information
Haifeng Xi authored Jul 1, 2019
2 parents 8d181d7 + f6ec9ca commit e4b1cde
Showing 1 changed file with 2 additions and 0 deletions.
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 e4b1cde

Please sign in to comment.