Description
I use last versions:
compile 'io.reactivex:rxjava:1.0.16'
compile 'io.reactivex:rxandroid:1.0.1'
If you set time, let's say, 5 hours ahead of current (example: we have 2:00 PM, set 7:00 PM), it seems library starts to think that it didn't work that whole time and starts to flood with
consecutive requests all the time.
Observable.interval(1, 30, TimeUnit.SECONDS)
.flatMap(new Func1<Long, Observable<CustomisationItem>>() {
@Override
public Observable<CustomisationItem> call(Long aLong) {
Log.d(TAG, "Request");
return custiomisationService.getCustomisation(
ParamUtils.getLanguage(),
ParamUtils.getClientVersion(appContext),
ParamUtils.getModel(appContext),
ParamUtils.getHardwareVesion(appContext));
}
})
.doOnError(new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Log.e(TAG, "Error: " + throwable.getMessage());
}
})
.retry()
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.unsubscribeOn(Schedulers.computation())
.subscribe(new Action1<CustomisationItem>() {
@Override
public void call(CustomisationItem customisationItem) {
Log.d(TAG, "Response");
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Log.e(TAG, "Error: " + throwable.getMessage());
}
});
11-17 17:34:29.459 D/MainFragment: Request
11-17 17:34:29.529 D/MainFragment: Response
//new time on device set here
//date --set="20:00:00"
//and flooding starts
11-17 20:00:03.769 D/MainFragment: Request
11-17 20:00:03.829 D/MainFragment: Response
11-17 20:00:03.829 D/MainFragment: Request
11-17 20:00:03.889 D/MainFragment: Response
11-17 20:00:03.889 D/MainFragment: Request
11-17 20:00:03.949 D/MainFragment: Response
11-17 20:00:03.949 D/MainFragment: Request
11-17 20:00:03.999 D/MainFragment: Response