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 efficientlyimplement this is appreciated!