Answer the question
In order to leave comments, you need to log in
RxJava2 onBackpressureBuffer() action, parameters, buffer?
In general, there is such code:
MyRetrofit.api.getPostsFlowable()
.onBackpressureBuffer()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
Log.e("onFlowable",it.toString())
}
Answer the question
In order to leave comments, you need to log in
Backpressure is a situation where the subscriber (consumer) consumes (processes) values more slowly than the emitter (producer) produces them. Then the events, of course, cannot go anywhere, they must be copied to the buffer, dropped (drop), or immediately throw an error when backpressure occurs. In your situation, obviously no backpressure can happen, because you just take data from the network (for a long time) and output it to the log (quickly).
You can simulate long processing by making an artificial delay (Thread.sleep) and making a fast emit. For example, for clarity, create a flowable, and throw 10,000 elements into it in a loop. And in the subscript - slip.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question