Is there a better way than doing this to re-launch...
# coroutines
j
Is there a better way than doing this to re-launch a Channel after its closed?
Copy code
@OptIn(ExperimentalCoroutinesApi::class)
private fun checkChannelState() {
    if (channel.isClosedForReceive || channel.isClosedForSend) {
        channel = Channel(Channel.BUFFERED)
    }
}
Like re-open it again if closed?
s
There’s no way to re-open or reset a closed channel, but there might be an alternative solution. What problem are you actually trying to solve?
j
Hard explain, its a SDK want shutdown and also channel. But able to restore it later on.