```@ObsoleteCoroutinesApi val LIMITED_PARALELLITY ...
# coroutines
r
Copy code
@ObsoleteCoroutinesApi
val LIMITED_PARALELLITY =
    Executors.newFixedThreadPool(2 * Runtime.getRuntime().availableProcessors()).asCoroutineDispatcher()

@ObsoleteCoroutinesApi
fun <E> Iterable<E>.forEachLimitedParallel(callable: (E) -> Unit) = runBlocking {
    forEach { launch(LIMITED_PARALELLITY) { callable(it) } }

}