Chachako
06/23/2022, 9:39 AMchannelFlow.collect
will resume? If there is a task in the channelFlow
block that doesn’t know when it will complete, when will the coroutines channel close?
I’m a little curious what the criteria is for the channel to determine channelFlow
completion, is it to wait a while without any send
and then end the hang?Sam
06/23/2022, 9:40 AMChachako
06/23/2022, 9:52 AMchannelFlow
resume works hahahaSam
06/23/2022, 9:55 AMawaitClose
, the flow will terminate as soon as the code inside the builder is done executing. With awaitClose
, it will run forever, until you explicitly stop collecting it. If you want anything different from those two options, you would need to implement it manually by calling close()
on the channel inside the builder.Chachako
06/23/2022, 9:58 AMSam
06/23/2022, 9:58 AMconfigureEach
just registers a callback that will be invoked "as each element is required", so it's likely that the flow would complete immediately, before the callback has been invoked on any of the items.