CJR
CJR

Reputation: 3572

function inside andThen() not emitting onComplete()

Here is my stream:

public Completable changeUserPassword(String oldPass, String newPass){
        return firebaseAuthRepositoryType.getCurrentUser()
                .flatMapCompletable(fu -> firebaseAuthRepositoryType.reAuthenticateUser(fu,fu.getEmail(),oldPass)
                   .andThen(firebaseAuthRepositoryType.changeUserPassword(fu, newPass)))
                .observeOn(AndroidSchedulers.mainThread());
}

Problem is the function inside andThen() never calls onComplete()? and the stream is "stuck" there. The return type of changeUserPassword() is Completable.

I tried to change out the function inside andThen() to Completable.complete() for debugging purposes but I saw the same behaviour. It still never "completes" and gets stuck in andThen()

Am I missing something here? Any suggestions?

The flow of the stream is supposed to be:

Upvotes: 0

Views: 151

Answers (1)

akarnokd
akarnokd

Reputation: 69997

Firebase is notorious with its never ending sequences so most likely firebaseAuthRepositoryType.getCurrentUser() never completes if it is an Observable or Flowable. Change it to Single or use take(1) to get one user.

Upvotes: 1

Related Questions