-
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
2.x : window(timespan, unit, count) always emit empty observable if not reach max count #5104
Comments
There are two problems with your code:
PublishSubject<String> vehicleToFetch = PublishSubject.create();
vehicleToFetch
.delay(2,TimeUnit.SECONDS)
.window(10, TimeUnit.SECONDS, 5)
.observeOn(Schedulers.io())
.subscribe(w-> w.toList().subscribe(ws-> {
ws.forEach(v -> {
System.out.println(String.format("%s %d", v, Thread.currentThread().getId()));
vehicleToFetch.onNext(v);
});
}));
Observable.just("v1","v2","v3","v4").subscribe(vehicleToFetch);
Thread.sleep(3000); |
@akarnokd Thanks. I am calling I am using a |
Yes, because the window with limit 4 will call |
Why did it not call |
Oh, I see it now. There is a bug in the operator that doesn't complete the old window if a new one is due to the timeout. I'll post a fix for it. |
Closing via #5106. |
It worked after upgrade to 2.0.7, but after three times timeout, there is no timeout anymore. |
Do you have a new unit test for it? |
You can use the same code , it will block after three new window emitted. |
Odd. I'll look into it again. |
Found a couple of remaining issues. See PR #5213; the example works with it properly for me. |
This code will print nothing all the time.
I am using rxjava:2.0.6.
The text was updated successfully, but these errors were encountered: