execute

abstract suspend fun <T> execute(block: suspend () -> T): T

Executes block after obtaining a permit from the rate limiter; may suspend or throw if the limit is exceeded.

Return

The result of block.

Parameters

block

The suspendable operation to run after a permit is acquired.

Type Parameters

T

The return type of the block.

Throws

When the rate limit is exceeded and no permit is obtained (e.g. no timeout configured or wait exceeded timeout).