fetchNextBatch fetches the next batch of keys from Redis matching the pattern "ref:*".
()
| 165 | |
| 166 | // fetchNextBatch fetches the next batch of keys from Redis matching the pattern "ref:*". |
| 167 | func (iter *ReferenceIter) fetchNextBatch() { |
| 168 | if iter.moreData { |
| 169 | var err error |
| 170 | iter.keys, iter.cursor, err = iter.client.Scan(ctx, iter.cursor, withNamespace(iter.namespacePrefix, referencePrefix, "*"), 100).Result() |
| 171 | if err != nil { |
| 172 | iter.moreData = false // In case of error, stop further fetching |
| 173 | return |
| 174 | } |
| 175 | // Update moreData based on whether the cursor returned to 0 |
| 176 | iter.moreData = (iter.cursor != 0) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | // Next retrieves the next reference, advancing the iterator. |
| 181 | func (iter *ReferenceIter) Next() (*plumbing.Reference, error) { |
no test coverage detected