Skip to content

Using withLatestFrom completes without values if other publisher is delayed #7288

Closed
@ivansenic

Description

@ivansenic

Version: 3.0.12

I am not sure if this is per-design and specification (could not find this), but is it really expected that:

      Flowable<Integer> integerFlowable = Flowable.just(1, 2, 3);
      Flowable<Integer> delayedFlowable = Flowable.just(10).delay(1, TimeUnit.SECONDS);

      integerFlowable.withLatestFrom(delayedFlowable, Integer::sum)
              .test()
              .assertValueCount(3)
              .assertComplete();

fails with:

java.lang.AssertionError: Value counts differ; expected: 3 but was: 0 (latch = 0, values = 0, errors = 0, completions = 1)
Expected :3
Actual   :0 (latch = 0, values = 0, errors = 0, completions = 1)
<Click to see difference>

If it is, then Javadoc needs to be improved, it is not stated anywhere that this will complete with no values of the other publisher is emitting item after a delay. Of course this is a simple example, but you get the point. If these would be two database calls and second comes emits after the first one, you get nothing? 😕

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions