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

Possibility to get direct rxdart stream to avoid memory leaks #26

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

pawlowskim
Copy link
Contributor

Possibility to use the library without memory leak that is caused by not cancelling stream subscriptions for merged streams from rxdart. No breaking changes, I kept current behaviour so to not break it work users.

Basically, creating broadcast stream and cancelling it does not nothing on the stream controller which is created in rxdart: dart-lang/sdk#26686 (comment)

The other way to fix it would be extend rxdart about possibility to return stream controller, and return both, broadcast stream and controller so user have full control over what is going down the path. But this could be overkill, and requires rxdart changes (tested that solution already). But, anyway, since we need to change the geo hash center position to start listening for different region, I would suggest using stream from rxdart directly.
The only thing that above is doesn't suits is when user need to have listener in couple places (different views for instance). But this also could be done by user by have single central place of the stream consumer.

@pawlowskim pawlowskim requested a review from zeusbaba as a code owner February 13, 2023 11:46
@pawlowskim pawlowskim mentioned this pull request Feb 13, 2023
@river2202
Copy link

+1

@bcbcbcbcbcl
Copy link

bcbcbcbcbcl commented Feb 18, 2023

This is required to cancel the old subscription when update center position or radius & can prevent high read usage on Firestore due to memory leak.

@FloLecoeuche
Copy link

@zeusbaba can you review this PR ?

Copy link
Member

@zeusbaba zeusbaba left a comment

Choose a reason for hiding this comment

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

Thanks for your contributions.
i'll merge this PR now, thereafter make a new release soon

@zeusbaba zeusbaba merged commit d95210b into beerstorm-net:master Mar 10, 2023
@zeusbaba
Copy link
Member

Thanks for your contributions.
i'll merge this PR now, thereafter make a new release soon

just published v2.3.15

zeusbaba added a commit that referenced this pull request Mar 10, 2023
* provide option to listen on source location stream which doesn't cause memory leaks, [fix from this PR](#26)
* upgrade dependencies

 https://pub.dev/packages/geoflutterfire2/changelog
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.

5 participants