withTimeout

suspend fun <T> withTimeout(
    block: suspend CoroutineScope.() -> T
): T

Execute block and cancel if doesn’t complete in time. Unlike the regular kotlinx.coroutines withTimeout, this also checks for cancellation first and fails immediately.