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

Bug/#427 make iterate by contribute more streamable, replace filter with takewhile #428

Conversation

rtroilo
Copy link
Member

@rtroilo rtroilo commented Sep 9, 2021

This is the PR for Issue #427

Task keep processing for a while despite it is canceled.

Description

Replacing/refactoring the for-loop in CellIterator iterateByContribution, to an Iterator which could be stream.
The previous approach with a for-loop keeps generating all Contributions for an OSHEntity, collecting those into an LinkedList and finally streams the list "out" of the method iterateByContribution.
The new version skips the collecting of all Contributions to a LinkedList completely, that has the advantage,

  • only one/two Contribution exists at a given time
  • stopping generating Contributions when not needed

Corresponding issue

Closes #427

Checklist

@rtroilo rtroilo requested a review from tyrasd September 9, 2021 13:51
@rtroilo rtroilo added the bug Something isn't working as expected label Sep 9, 2021
@rtroilo rtroilo changed the title Bug/#427 make iterate by contribute more streamable replace filter with takewhile Bug/#427 make iterate by contribute more streamable replace, filter with takewhile Sep 9, 2021
@rtroilo rtroilo changed the title Bug/#427 make iterate by contribute more streamable replace, filter with takewhile Bug/#427 make iterate by contribute more streamable, replace filter with takewhile Sep 9, 2021
Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

👍 thank you for this well needed improvement. it would be nice to eventually do the same for the snapshot view part of the cell iterator as well. 😄

a few inline questions and comments are below

@rtroilo rtroilo force-pushed the bug/#427_make_iterateByContribute_more_streamable_replace_filter_with_takewhile branch 2 times, most recently from 0ee81eb to 8c7af5f Compare September 13, 2021 16:35
Copy link
Member

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

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

would you like to add a line to the changelog for this? I think this is a nice improvement, which does deserve to be mentioned. 👍

@rtroilo
Copy link
Member Author

rtroilo commented Sep 15, 2021

would you like to add a line to the changelog for this? I think this is a nice improvement, which does deserve to be mentioned. +1

Done. I also create a new Issue #429 for the snapshot view part as well.

tyrasd
tyrasd previously approved these changes Sep 15, 2021
breaking for-loop up into iterator
opening up iterateBy to accept Iterables instead of GridOSHEntity
@tyrasd tyrasd force-pushed the bug/#427_make_iterateByContribute_more_streamable_replace_filter_with_takewhile branch from 5f00924 to 17c0155 Compare September 15, 2021 16:30
@tyrasd tyrasd merged commit c03ab5e into master Sep 16, 2021
@tyrasd tyrasd deleted the bug/#427_make_iterateByContribute_more_streamable_replace_filter_with_takewhile branch September 16, 2021 07:42
tyrasd pushed a commit that referenced this pull request Sep 16, 2021
breaking for-loop up into iterator
opening up iterateBy to accept Iterables instead of GridOSHEntity
replace filter with takeWhile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

canceled task could "hang" for more than 20 minutes
2 participants