https://kotlinlang.org logo
u

uli

11/07/2017, 12:19 PM
@frogman544 Coroutines give you the pleasure of sequential coding style. Just wrap your call without retries and then call it inside a loop. Something like this (pseudo code):
Copy code
suspend fun awaitResult(retries: Int) : Result {
  var retriesLeft = retries
  while (retriesLeft-- > 0) {
    var result = awaitResult() // Await result without retries
    if ( !(result is Result.Exception) ) return result 
  }
  return result
}