我知道:
retryWhen(...)
允许我们重试错误
和repeatWhen(...)
允许重试完整
是否有这样的运营商:
return Observable.just(isUpdating)
.repeatWhenOnNext(isUpdating -> {
if(isUpdating) {
return Observable.timer(2, TimeUnit.SECONDS); // repeat after two seconds
} else {
return Observable.just(isUpdating); // flow down to concatMap
}
})
.concatMap(o -> doSomeWorkONLYWhenIsNotUpdating());
答案 0 :(得分:1)
嗯......不,但也许会这样做:
return Observable
.interval(0, 2, TimeUnit.SECONDS)
.filter(dummy -> !isUpdating)
.take(1)
.flatM(dummy -> doSomeWorkONLYWhenIsNotUpdating());