RateLimiter

interface RateLimiter(source)

A rate limiter that limits the number of consume invocations that can be made over a certain period.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun consume()

Acquires a permit for a single action. Suspends if necessary until the permit would not exceed the maximum frequency of permits.

Link copied to clipboard
inline suspend fun <T> RateLimiter.consume(action: () -> T): T

Acquires a permit for a single action. Suspends if necessary until the permit would not exceed the maximum frequency of permits.