-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Fixes on #284 (groupBy) #289
Conversation
RxJava-pull-requests #163 SUCCESS |
I apologize for not being able to act on this right now, I've been swamped with other work but I will definitely return to this once I get through my other work! |
return; | ||
} | ||
/* | ||
* Technically the source should be single-threaded so we shouldn't need to do this but I am |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indent
squash into a single commit then check with @benjchristensen. LGTM |
RxJava-pull-requests #170 SUCCESS |
Hi Ben et alii, Regarding the issues at the end of the previous discussion, I mentioned the quirks I found to Erik, who actually considered the current terminating behaviour of
In this example, the take(2) may cause termination of the groupBy's upstream subscription because the GroupedObservables still have no subscribers. It actually creates a race between the spawned and spawning thread. I guess the solution to this would be to not automatically terminate the upstream subscription when one might still connect to a GroupedObservable. This would lead to some memory pollution if the stream is infinite and not terminated manually (for example using |
I tried looking at this again this morning but again ran out of time trying to understand what the issue is and what is being fixed ... it's still on my list for a more focused review at some point. |
Here's another problem with groupBy: This code val firstOnly = false
val numbersByModulo3 = Observable.interval(1000 millis).take(9).groupBy(_ % 3)
(for ((modulo, numbers) <- numbersByModulo3) yield {
println("Observable for modulo" + modulo + " started")
if (firstOnly) numbers.take(1) else numbers
}).merge.toBlockingObservable.foreach(println(_)) outputs if
and if
But I would expect that it takes the first element of each modulo class:
|
and try to make Olympics groupBy work with timing, but did not work due to problems with RxJava groupBy, see pull ReactiveX#289
Can anyone start from scratch on reviewing this and providing feedback? @headinthebox Can you also provide input on what the behavior should be compared to Rx.Net? You've mentioned to both @Treora and myself that you feel something is wrong with the Rx.Net implementation, so I'd like to know what unit tests we should have so we can change RxJava to match the correct functionality. |
Hi, The reason why it is like this in Rx.Net is because there seems to be no elegant solution to this issue. The point is that the Let me know if you would like me to explain more. My work involving RxJava finished, but it would be nice if this issue will be fixed. Also, it seems these fixes I wrote (#289) have still not been merged, so doing that could already fix some bugs. If then the small issue mentioned in point 2 in #282 (comment) is also fixed, the RxJava implementation should be at least as good as the current Rx.Net implementation (or probably a bit better, as their code looks somewhat buggy too, as mentioned before). |
@zsxwing Since you have become familiar with a lot of the codebase, if you want to help tackle this I'd appreciate it. |
@benjchristensen I'll try to solve it. |
Thanks @zsxwing |
I've implemented GroupByUntil (#528) which can be turned into GroupBy by using
someObserver will likely get just an onCompleted(). If I understand the problem correctly, you'd want to receive Xs for the first two groups until they cancel, even if there won't be any new groups due to take(2). How about:
This way we'll know what the first two group keys would be, then filter the source based on that in each group. However, lets assume source emits
|
Closing this and it will be addressed via #570 |
and try to make Olympics groupBy work with timing, but did not work due to problems with RxJava groupBy, see pull ReactiveX#289
See my previous comment.