Skip to content

Instantly share code, notes, and snippets.

@pamartineza
Last active September 7, 2018 10:47
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 pamartineza/758cd5bc4826d11729d52d1be6097585 to your computer and use it in GitHub Desktop.
Save pamartineza/758cd5bc4826d11729d52d1be6097585 to your computer and use it in GitHub Desktop.
//retryCount is a Long variable value
//eg. When retryCount = 1, observable emmits a 0L after 2 sec, then completes
//eg. When retryCount = 2, observable emmits a 0L after 4 sec, then completes
//eg. When retryCount = 3, observable emmits a 0L after 8 sec, then completes
Observable.timer(Math.pow(2.toDouble(), retryCount.toDouble()).toLong(), TimeUnit.SECONDS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment