Skip to content

Instantly share code, notes, and snippets.

@agustarc
Created August 15, 2019 10:04
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/e60e6f06cef6efaa8a3fdf079116e405 to your computer and use it in GitHub Desktop.
Save agustarc/e60e6f06cef6efaa8a3fdf079116e405 to your computer and use it in GitHub Desktop.
retryWhen { attempts ->
Flowables.zip(
attempts.map { error -> if (error is IOException) error else throw error },
Flowable.interval(1, TimeUnit.SECONDS)
).map { (error, retryCount) -> if (retryCount >= 3) throw error }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment