-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Labels
Description
I've got parametrized rest call with Observable interface:
api.updateAppState(params);
I want to repeat it with delay so I have created delayed version of it:
Observable<AppState> delayedApiCall = Observable.interval(delay, TimeUnit.SECONDS)
.first()
.flatMap(new Func1<Long, Observable<AppState>>() {
@Override
public Observable<AppState> call(Long seconds) {
return lyftApi.updateAppState(params);
}
});
But now I want to have polling observable that will recreate "delayedApiCall" with params and produce continuous results. I also want observable to continue producing results even if error was returned in "delayedApiCall".
pollingObservable.subscribe(new Observer<AppState>() {
onNext(AppState appSte) {
....
},
onError(Throwable e) {
....
}
});