Skip to content

Commit

Permalink
Close an existing iterator if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Aug 22, 2024
1 parent d2e6590 commit d37b6e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/db/fetcher/indexer_iterators.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ var _ indexIterator = (*indexPrefixIterator)(nil)
func (iter *indexPrefixIterator) Init(ctx context.Context, store datastore.DSReaderWriter) error {
iter.ctx = ctx
iter.store = store
if iter.resultIter != nil {
if err := iter.resultIter.Close(); err != nil {
return err
}
}
iter.resultIter = nil
return nil
}
Expand Down

0 comments on commit d37b6e4

Please sign in to comment.