https://kotlinlang.org logo
u

uli

04/26/2018, 10:25 AM
Actually, here is my code that breaks if I use `tailrec`:
Copy code
/* tailrec */ suspend fun respectRateLimit(uri: String) {
        getRateLimitDelayMs(uri)?.let { delayMs ->
            delay(delayMs, TimeUnit.MILLISECONDS)

            // Maybe, a new delay has been registered
            return respectRateLimit(uri)
        }
    }