In my Project I am using Ktor to download *many Fi...
# coroutines
In my Project I am using Ktor to download *many Files*_(each almost 4mb_) I have a Coroutine Scope(IO) at App Level (_i.e., act_ive throught application Lifecycle.) Now as of now , I am Just *Blindly Launching coroutines(like 150 of them)* in this scope which download Files. Instead, I want to alter it to act as described Below: 1. Making this scope to only run a certain number of courtines parallelly say 4. 2. launching in this scope remains same, launch 150 or more coroutines all together and let the scope handle parallel downloads 3. A function , returning number of active/pending coroutines in this scope. Any help in pointing me in the right direction to correctly and efficiently implement this is appreciated!
🤔 1
I built something similar for similar reason once:
👍 1
Id recommmend you to look into channels it you want to limit concurrency