These are chat archives for ReactiveX/RxJava

17th
Apr 2018
Joshua Street
@jjstreet
Apr 17 2018 02:41
hello all
hopefully have a simple question
i have a class that acts as a client, returning singles
i want poll with this single
public Flowable<List<String>> poll() {
    return this.client.getData(this.host)
            .subscribeOn(this.scheduler)
            .retryWhen(errors -> Flowable.timer(this.retryDelay, TimeUnit.MILLISECONDS, this.scheduler))
            .repeatWhen(success -> success.delay(this.delay, TimeUnit.MILLISECONDS, this.scheduler));
}
this is how i have setup my polling method
i have a working test for repeatWhen
but my problem is trying to write a test for retrying
i can't figure out if i have working
Joshua Street
@jjstreet
Apr 17 2018 02:50
hmm this works
public Flowable<List<String>> poll() {
    return this.client.getData(this.host)
            .retryWhen(errors -> Flowable.timer(this.retryDelay, TimeUnit.MILLISECONDS, this.scheduler))
            .subscribeOn(this.scheduler)
            .repeatWhen(success -> success.delay(this.delay, TimeUnit.MILLISECONDS, this.scheduler));
}
David Karnok
@akarnokd
Apr 17 2018 08:14
You have to compose over errors in retryWhen, just like in repeatWhen.