Skip to content

Instantly share code, notes, and snippets.

@agustarc
Last active August 15, 2019 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustarc/07a0a28d57a8a1baf9fe5cd724124fd9 to your computer and use it in GitHub Desktop.
Save agustarc/07a0a28d57a8a1baf9fe5cd724124fd9 to your computer and use it in GitHub Desktop.
single.retryWhen { attempts ->
Flowables.zip(
attempts.map { error -> if (predicates.count { it(error) } > 0) error else throw error },
Flowable.interval(interval, unit)
).map { (error, retryCount) -> if (retryCount >= maxRetries) throw error }
}
single.onErrorResumeNext(resumeNext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment