Skip to content

Instantly share code, notes, and snippets.

@oks
Created April 10, 2015 08:37
Show Gist options
  • Save oks/e5157b9953aabe4aa7ee to your computer and use it in GitHub Desktop.
Save oks/e5157b9953aabe4aa7ee to your computer and use it in GitHub Desktop.
- (RACSignal *)endlessPollingWithSuccessDelay:(NSTimeInterval)successDelay failureDelay:(NSTimeInterval)failureDelay {
return [[[
// After completion - Wait for successDelay
[self concat:[[RACSignal empty] delay:successDelay]]
// After failure - Wait for failure delay
catchTo:[[RACSignal empty] delay:failureDelay]]
// Resubscribe
repeat]
setNameWithFormat:@"Endless polling (%02.f/%02.f) of [ %@ ]", successDelay, failureDelay, self.name];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment