# coroutines

Krishna Chinya

02/08/2023, 6:14 AM
Hello, I’m queuing network requests when device is offline in db and service picks it up and runs when device comes online. I was using rx java before, I moved whole thing to coroutines now and facing some issues which is blocking other network call until all my queued requests are complete. say, If I have 1000 requests queued and when I run it on using limitedParallelism(5) it blocks other network calls that happens from app. Can someone please help . You can find the code snippet below.
Copy code
withContext( {
            async { //build queuedrequest list }
            // then I process the request.
Android Service calls the above code snippet
Copy code
scope = CoroutineScope(<|> + SupervisorJob())

// Then
scope.launch { 
// calling the above code in repository