You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I notices a problem when using Single.timeout with a value really small. So in the snippet bellow you will see 0 nanoseconds, but it also happens with 10 nanoseconds. So also values > 0.
The problem is, that in such a case, the error is no always emitted.
for (inti = 0; i < 10000000; i++) {
finalinty = i;
finalCountDownLatchlatch = newCountDownLatch(1);
Single.never()
.timeout(0, TimeUnit.NANOSECONDS, Schedulers.computation())
.subscribe(v -> {}, e -> {
System.out.println("timeout " + y);
latch.countDown();
});
if (!latch.await(1, TimeUnit.SECONDS)) {
thrownewIllegalStateException("Timeout was not happening!");
}
}
The workaround so far for me is to use a Single.timer instead.
for (inti = 0; i < 10000000; i++) {
finalinty = i;
finalCountDownLatchlatch = newCountDownLatch(1);
Single.amb(Arrays.asList(Single.never(), Single.timer(0, TimeUnit.NANOSECONDS, Schedulers.computation()).doOnSuccess(l -> {
thrownewTimeoutException();
})))
.subscribe(v -> {}, e -> {
System.out.println("timeout " + y);
latch.countDown();
});
if (!latch.await(1, TimeUnit.SECONDS)) {
thrownewIllegalStateException("Timeout was not happening!");
}
}
The above snippets take like 2-3 minute to run in the success case. Most of the time the first one fails during that time, but sometimes also succeeds.
I tested it also with Observable, but could not notice the problematic behavior.
Do you have an idea where this comes from?
The text was updated successfully, but these errors were encountered:
Recently I notices a problem when using Single.timeout with a value really small. So in the snippet bellow you will see 0 nanoseconds, but it also happens with 10 nanoseconds. So also values > 0.
The problem is, that in such a case, the error is no always emitted.
The workaround so far for me is to use a Single.timer instead.
The above snippets take like 2-3 minute to run in the success case. Most of the time the first one fails during that time, but sometimes also succeeds.
I tested it also with Observable, but could not notice the problematic behavior.
Do you have an idea where this comes from?
The text was updated successfully, but these errors were encountered: