Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve first iteration logic #1121

Merged
merged 2 commits into from
Nov 27, 2022
Merged

Improve first iteration logic #1121

merged 2 commits into from
Nov 27, 2022

Conversation

ikonst
Copy link
Contributor

@ikonst ikonst commented Nov 25, 2022

Backporting #1101 to 5.x branch to allow handling an exception raised when retrieving the first item.

This was reported by a user (our retry mechanism apparently doesn't kick in).

Improving the first iteration logic in `PageIterator` and `ResultIterator`.

Both iterators had a `_first_iteration` state attribute that could be replaced with better logic:
- In `PageIterator`, it can be replaced with `_is_last_page` which
  - is exception-safe (only mutate after we do I/O), and
  - (IMO) more directly relates to the state we're handling
- In `ResultsIterator`, we can do without `_first_iteration` (but we should initialize `_index` and `_count`)

Inspired by #1059.
@ikonst ikonst changed the title Improve first iteration logic (#1101) Improve first iteration logic Nov 25, 2022
@ikonst
Copy link
Contributor Author

ikonst commented Nov 26, 2022

Got to update release notes and bump version before merging.

@ikonst ikonst merged commit d2037b8 into 5.x Nov 27, 2022
@ikonst ikonst deleted the 2022-11-25-backport-1101 branch November 27, 2022 03:36
@ikonst ikonst mentioned this pull request Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants