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

RUST-1046 Fix iteration of cursors when batchSize doesn't divide result size #483

Conversation

patrickfreed
Copy link
Contributor

RUST-1046 (fixes #482)

This PR fixes a bug in SessionCursor where iterating it with next() would always eventually result in an error if the result count wasn't divisible by the batchSize.

@@ -61,7 +61,6 @@ pub struct SessionCursor<T>
where
T: DeserializeOwned + Unpin,
{
exhausted: bool,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue here is that the GenericCursor created in stream was using the info.id field to determine if the cursor was exhausted rather than this exhausted field, which would cause it to iterate past the end and return an error. This was fixed by using info.id as the single source of truth as to whether the SessionCursor is exhausted or not.

@patrickfreed patrickfreed marked this pull request as ready for review October 8, 2021 20:18
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.

aggregate_with_session fails when collection size > batchSize
3 participants