D
D
Denis2018-03-21 12:29:44
Java
Denis, 2018-03-21 12:29:44

How to slow down Observable on error?

I want to "slow down" the execution of too fast requests a little :)
I do something like this

Observable.zip(remoteObservable, Observable.timer(1, SECOND)).subscribe {
}

As a result, I get: if the remote request was completed too quickly, then we will receive the value after 1 second, otherwise we wait until the response is received.
There was a problem, if an error arrives, then the observable notifies about it immediately.
Question: is it possible to somehow slow down error to 1 second if the error occurred quickly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2018-03-21
@zagayevskiy

OMG.
I would use throttle[last/withTimeout] instead of zip. The error can be swallowed with onErrorResumeNext - and then re-thrown.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question