Closed
Description
Hi guys!
I'm using Flowable.scan(seed)
to accumulate values of infinite sequence(stream of updates from server that comes not so often). The problem is that whenever FlowableScanSeed receives new value it publishes previous one. I guess it's not a problem with a finite sequence(at completion all values will be published anyway), but with infinite seq the last value is held until next comes.
I wrote test case to demonstrate the issue
@Test
public void testScanWithSeedEmitsAllItemsOnInfiniteSequence() {
Flowable.concat(Flowable.just(1, 2, 3), Flowable.<Integer>never()).scan(0, SUM)
.test(4)
.assertValues(0, 1, 3, 6);
}
Here seed+3 values are expected, but since sequence is infinite last value never comes.
I don't have much experience with rx so can't provide you with a patch, sorry ;)