Skip to content

Commit

Permalink
Update ChannelManager.kt
Browse files Browse the repository at this point in the history
Signed-off-by: Luki <[email protected]>
  • Loading branch information
lukisk committed May 21, 2024
1 parent 63928aa commit 6d9ca47
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.flow.Flow
import org.mobilenativefoundation.store.multicast5.ChannelManager.Message
import kotlin.coroutines.cancellation.CancellationException

internal interface ChannelManager<T> {

Expand Down Expand Up @@ -55,7 +56,11 @@ internal interface ChannelManager<T> {

suspend fun dispatchValue(value: Message.Dispatch.Value<T>) {
_awaitsDispatch = false
channel.send(value)
try {
channel.send(value)
} catch (e: CancellationException) {
// ignore
}
}

fun dispatchError(error: Throwable) {
Expand Down

0 comments on commit 6d9ca47

Please sign in to comment.