https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Albert

06/02/2020, 5:53 PM
I am facing issue currently where multiple
.send
are done on a channel. At some point we close the channel, but we still have some
.send
open. I assumed that
.close
would throw an exception or stops suspending for the ones who tries to
.send
. But this is not the case. So is it best practise with channel to drain them with
.consume
or
.consumeEach
?
z

Zach Klippenstein (he/him) [MOD]

06/02/2020, 5:56 PM
cancel
will interrupt senders, but
close
effectively just enqueues a “close token”.
a

Albert

06/02/2020, 5:57 PM
That is exactly what I was looking for. thanks!
2 Views