Jacques Smuts
08/15/2019, 6:52 PM.collect gets cancelled, then the awaitClose block gets called.
However if a CoroutineContext is suspended on a Channel’s .receive() and gets cancelled, then the invokeOnClose on that Channel does not get called. You have to manually close the channel. Is that expected behaviour? There’s no automatic propagation of Coroutine cancellation into Channels?louiscad
08/15/2019, 6:55 PMconsume { … } and call receive() inside its lambda, or use consumeEach straightaway.Jacques Smuts
08/15/2019, 7:01 PMJacques Smuts
08/15/2019, 7:01 PMJacques Smuts
08/15/2019, 7:01 PMconsume propagates, but receive doesn’t 🤔louiscad
08/15/2019, 7:24 PMclose, cancel, consume or consumeEach. You might have multiple coroutines calling receive. Cancelling one shouldn't close the channel for the remaining.Jacques Smuts
08/15/2019, 7:34 PMconsume lists that in the documentation. This all makes sense, there’s just a lot of discovery and reading left for me. Thanks for educating 🙂