question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.1.2 Completable with andThen never completes

See original GitHub issue

This test fails:

Completable.complete()
        .andThen{ Completable.complete() }
        .test()
        .assertComplete()

However this one succeeds:

Completable.complete()
        .test()
        .assertComplete()

This one also succeeds:

    Flowable.just("")
            .flatMap { Flowable.just("") }
            .test()
            .assertComplete()

My understanding is that concating (which is what andThen does?) two completables which complete immediately should complete. I tried:

  • using awaitForTerminalEvent but it just runs forever in the first case.
  • .andThen{} instead of .andThen{ Completable.complete() }
  • Completable.fromCallable instead of Completable.complete() or switching from a Flowable to Completable

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

91reactions
JakeWhartoncommented, Aug 12, 2017

You want andThen(Completable.complete()). Note the use of parenthesis and not curly braces. The latter creates a lambda that doesn’t call its emitter.

On Sat, Aug 12, 2017, 11:30 AM Michał Klimczak notifications@github.com wrote:

This test fails:

Completable.complete() .andThen{ Completable.complete() } .test() .assertComplete()

However this one succeeds:

Completable.complete() .test() .assertComplete()

This one also succeeds:

Flowable.just("")
        .flatMap { Flowable.just("") }
        .test()
        .assertComplete()

My understanding is that concating (which is what andThen does?) two completables which complete immediately should complete. I tried:

  • using awaitForTerminalEvent but it just runs forever in the first case.
  • .andThen{} instead of .andThen{ Completable.complete() }
  • Completable.fromCallable instead of Completable.complete() or switching from a Flowable to Completable

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ReactiveX/RxJava/issues/5551, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEbqMY0_Tox59wudzvNRhY1aL1URWks5sXe8mgaJpZM4O1fDE .

10reactions
akarnokdcommented, Aug 12, 2017

Please be patient on StackOverflow (deleted) next time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CompletableSubject (RxJava Javadoc 2.1.2)
public final class CompletableSubject extends Completable implements CompletableObserver ... Returns true if this CompletableSubject has been completed.
Read more >
RxJava `Completable.andThen` is not executing serially?
The issue is not with andThen but with the statement Observable.just(mUser.name) inside andThen . The just operator will try to create the ...
Read more >
RxJava Completable.andThen never triggers the second ...
Try: andThen(userService.updateMessagingUserLanguages(user.id, languageRequest)). IOW, replace the lambda expression as a parameter with the ...
Read more >
Completable (RxJava Javadoc 2.2.21) - ReactiveX
Returns a Flowable which will subscribe to this Completable and once that is completed then will subscribe to the next Flowable. <T> Single<T>,...
Read more >
Completable (RxJava Javadoc 3.1.5) - ReactiveX
Disposable d = Completable.complete() .delay(10, TimeUnit. ... Returns a Completable that first runs this Completable and then the other CompletableSource .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found