Skip to content

Commit 464d231

Browse files
committed
Address cursor suggestions
1 parent e745d4e commit 464d231

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/main/java/redis/clients/jedis/search/aggr/AggregateIterator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public AggregateIterator(ConnectionProvider connectionProvider, String indexName
101101

102102
@Override
103103
public boolean hasNext() {
104-
return aggrCommandResult != null || cursorId > 0;
104+
return aggrCommandResult != null || cursorId != null && cursorId > 0;
105105
}
106106

107107
@Override
@@ -155,10 +155,8 @@ public void close() {
155155
// Mark cursor as closed to prevent further operations
156156
cursorId = -1L;
157157

158-
Object entryValue = connectionEntry.getValue();
159-
if (entryValue instanceof Connection) {
160-
((Connection) entryValue).close();
161-
}
158+
// NOTE(imalinovskyi): If we use single connection to execute commands, we're not
159+
// responsible for closing it here.
162160
}
163161

164162
/**

0 commit comments

Comments
 (0)