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

Fix query result lazy loading #186

Merged
merged 4 commits into from Sep 6, 2017
Merged

Fix query result lazy loading #186

merged 4 commits into from Sep 6, 2017

Conversation

andrykonchin
Copy link
Member

Old behaviour of Model.where({}).all:

  • load lazily if user specified batch size
  • load all collection into memory otherwise

Proposed behaviour - always return lazy evaluated collection

It means Model.where({}).all returns Enumerator instead of Array. If you need Array interface you have to convert collection to Array manually with to_a method call

@coveralls
Copy link

coveralls commented Aug 25, 2017

Coverage Status

Coverage increased (+0.005%) to 96.697% when pulling f703786 on andrykonchin:fix-query-result-lazy-paginating-2 into eb88b98 on Dynamoid:master.

@andrykonchin
Copy link
Member Author

@pboling @richardhsu I propose to not merge open PRs untill new release. I beleive we should release new version with bug fixes ASAP

@pboling
Copy link
Member

pboling commented Aug 30, 2017

I agree, this will be merged after the new release.

Copy link
Member

@pboling pboling left a comment

Choose a reason for hiding this comment

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

This is awesome. Minor changes to a comment.

@@ -56,9 +56,11 @@ def all
end

# Returns the last fetched record matched the criteria
# Enumerable doesn't implement it, only `first`
# So we have to implement it themselves
Copy link
Member

Choose a reason for hiding this comment

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

it => last (more specific)
themselves => ourselves (grammar)

@andrykonchin
Copy link
Member Author

@pboling done

@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage increased (+0.005%) to 96.697% when pulling 4be2621 on andrykonchin:fix-query-result-lazy-paginating-2 into eb88b98 on Dynamoid:master.

@pboling pboling self-requested a review August 30, 2017 22:59
Copy link
Member

@pboling pboling left a comment

Choose a reason for hiding this comment

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

Great!

@pboling
Copy link
Member

pboling commented Sep 6, 2017

@andrykonchin Dynamoid 1.3.4 is released. This should be rebased / build fixed and merged!

@andrykonchin
Copy link
Member Author

done

@coveralls
Copy link

coveralls commented Sep 6, 2017

Coverage Status

Coverage increased (+0.005%) to 96.702% when pulling 3a49e87 on andrykonchin:fix-query-result-lazy-paginating-2 into f97dc16 on Dynamoid:master.

@pboling
Copy link
Member

pboling commented Sep 6, 2017

I have created a 1-3-stable branch for maintenance of the old version (current release), so now we can start working on the next version, which I expect will have major breaking changes, and so should be version 2.0.0.
CC @andrykonchin @richardhsu

@pboling pboling merged commit 073b1b9 into Dynamoid:master Sep 6, 2017
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

4 participants