-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Description
I ran the below test code with RxJava 2.0.7 and got a failure which succeeded with RxJava 1.x.
final TestObserver<Boolean> observer = TestObserver.create();
Observable.<Boolean>create(emitter -> {
emitter.onNext(Thread.interrupted());
emitter.onComplete();
})
.delaySubscription(100, TimeUnit.MICROSECONDS)
.subscribe(observer);
observer.awaitTerminalEvent();
observer.assertValue(false);
}
If I put subscribeOn()
before delaySubscription()
, it does not fail.
I am not sure if it is as expected so want to know if it is the expected behaviour.
Here is some background of my issue: I am using RxJava 2.0.7 with Retrofit 2.2.0 and it seems Retrofit (precisely speaking, Okio, which is being used in OkHttp) throws an error when the thread is interrupted while it tries to read the HTTP response. I am trying to delay the HTTP call to achieve something like debounce() with delaySubscription() operator and encountered this issue. I have a workaround so just want to know if it is the expected behaviour.
Thank you for your support in advance.