https://kotlinlang.org logo
Title
a

asad.awadia

06/12/2019, 11:53 AM
But that never gets executed cause the consumeEach never breaks
d

Dico

06/12/2019, 7:37 PM
consumeEach will cancel coroutine after last element is received by throwing an exception
Use
for (item in channel)
instead
a

asad.awadia

06/12/2019, 8:00 PM
When does that for loop exit?
d

Dico

06/12/2019, 8:57 PM
When the channel is closed for receive.
a

asad.awadia

06/12/2019, 8:57 PM
Thats not very helpful
I know the basics
I m talking about a real use case
There are 4 files - if i close the channel how will the other files write their part to it
d

Dico

06/12/2019, 8:58 PM
What I understood is that code following your
consumeEach
is not getting executed. This would solve that problem. I'm not suggesting anything else.
a

asad.awadia

06/12/2019, 8:58 PM
Consume each is not exiting
Exiting
Like execute the code after it
d

Dico

06/12/2019, 8:59 PM
I dont have near enough information to answer your question then, so if you know the basics like you say I'm sure you can figure it out with a bit of debugging