Create a gist now

Instantly share code, notes, and snippets.

@jdamcd /Interval.java Secret
Last active Sep 20, 2015

Observable<ServiceResult> pollService() {
return Observable.interval(2, TimeUnit.SECONDS)
.take(3)
.flatMap(tick -> fetchResult())
.takeFirst(result -> !result.isProcessing());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment