-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Change Thread in retryWhen will go into disposed #5490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure how you run the example code but due to |
Since the .retryWhen(new Function<Observable<Throwable>, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(@NonNull Observable<Throwable> throwableObservable) {
return throwableObservable
.takeWhile(new Predicate<Throwable>() {
int counter;
@Override
public boolean test(Throwable v) throws Exception {
return ++counter < 2;
}
})
.flatMap(new Function<Object, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(@NonNull Object o) throws Exception {
return Observable.timer(0, TimeUnit.MILLISECONDS);
}
});
}
}) Here, |
Thanks. I run the code in android(a click listener) environment. Finally I found a post about compose |
Looks like this question has been answered. If you have further input on the issue, don't hesitate to reopen this issue or post a new one. |
rxjava 2.1.1
I have a
retryWhen
operator in my stream like follow:The code above seems ok:
But if you uncomment the
observeOn
line, the secondmap
operator may not be reached, the output follow:I debug the code and found that the first round awalys be ok, but in the second round(emitted by retry operator), first
map
procedure is ok, the secondmap
procedure(belowobserveOn
) may or may not be called. And even if the secondmap
procedure is called, thedisposable[0].isDisposed() == true
.So, is it anything wrong in my code or rxjava bug?
The text was updated successfully, but these errors were encountered: