1

I want to receive success after successful retry. Here's my minimal working example:

        var i = 0

        Observable.just(i)
            .flatMapSingle {
                println(i)
                i++
                when {
                    it < 3 -> Single.error(Exception())
                    else -> Single.just(it)
                }
            }
            .retryWhen { errorObservable -> errorObservable
                .take(4)
            }
            .subscribe { println("subscribe $i") }

this will subscribe and print 0, subscribe 1. If I uncomment commented lines, I'll get only 0, 1, 2, 3 How do I get successful value in subscribe in given example?

Antek
  • 721
  • 1
  • 4
  • 27

0 Answers0