-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Description
When I attempt to use retryWhen to delay a retry with Completable or Single I receive an incompatible types error, as demonstrated in the following code:
Completable.error(new RuntimeException())
.retryWhen(new Function<Flowable<Throwable>, Publisher<Object>>() {
@Override
public Publisher<Object> apply(@io.reactivex.annotations.NonNull Flowable<Throwable> source) throws Exception {
return source.delay(5, TimeUnit.SECONDS); // <- Incompatible type error
}
});
Single.error(new RuntimeException())
.retryWhen(new Function<Flowable<Throwable>, Publisher<Object>>() {
@Override
public Publisher<Object> apply(@io.reactivex.annotations.NonNull Flowable<Throwable> source) throws Exception {
return source.delay(5, TimeUnit.SECONDS); // <- Incompatible type error
}
});
However, there are no issues with Observable or Flowable:
Observable.error(new RuntimeException())
.retryWhen(new Function<Observable<Throwable>, ObservableSource<?>>() {
@Override
public ObservableSource<?> apply(@io.reactivex.annotations.NonNull Observable<Throwable> source) throws Exception {
return source.delay(5, TimeUnit.SECONDS);
}
});
Flowable.error(new RuntimeException())
.retryWhen(new Function<Flowable<Throwable>, Publisher<?>>() {
@Override
public Publisher<?> apply(@io.reactivex.annotations.NonNull Flowable<Throwable> source) throws Exception {
return source.delay(5, TimeUnit.SECONDS);
}
});
Looks like there is an issue with the return types for apply?
Reactions are currently unavailable