-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Support creating unbounded ReplaySubject #276
Conversation
Hi @fpillet , @ashfurrow Yeah, I was thinking about should I expose that overload or not. I think that if we would want to expose that, we would want to have interface something like this
... because it doesn't really have an upper bound. I am little worried that people will just use this unbounded one without thinking. The problem with using unbounded version is that you are potentially creating a memory leak (you need to store all generated elements). If you guys want us to expose this, I guess I'm fine with it. I think we would also need to add unit tests for this unlimited version like we've done for version with 1 and many :) |
Yeah, I can understand the concerns. Introducing friction to limit accidental use sounds 👍 to me. For my case, at least, 99% of the time I'll be just sending |
I usually find that having to specify an upper bound is cumbersome because most of the time, your code will behave reasonably well and not fill up memory. When this happens, and when using a This said, maybe you'll want it exposed in a more explicit way:
Either way is fine with me. I can change my PR or let you do it your way. Let me know. As to tests, yes for sure will have to figure out some reasonable tests for this. Want them added to the PR? |
@fpillet yeah, I have thought about I think it jiggles reader's mind more, and hoping they will investigate what unbounded means :) I think it would be great if you could add unit tests to this PR before merging this so I can remove this from my mental stack for good :) Just analogous tests to ones we have for 1 and many version, nothing fancy :) |
@kzaher : ok will do this w-e. I also need to add an Opinions? |
@fpillet I think maybe just exposing that subject for now is ok. I am curios in what case would somebody want that Since that's just a convenience for |
- added ReplaySubject.createUnbounded() to create unlimited subjects - added replayAll() method to ObservableType
I think this looks reasonable :) I'll probably add a warning about memory allocation in docs to further warn the users :) |
Support creating unbounded ReplaySubject
There was previously no way to externally instantiate the
ReplayAll
concrete class