Skip to content

Commit

Permalink
fix: Prevent coroutine crashing on errors (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziodemaria authored May 29, 2024
1 parent 1e71fb9 commit d75229a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down Expand Up @@ -43,7 +44,7 @@ class Confidence internal constructor(
private val contextChanges: Flow<Map<String, ConfidenceValue>> = contextMap
.drop(1)
.distinctUntilChanged()
private val coroutineScope = CoroutineScope(dispatcher)
private val coroutineScope = CoroutineScope(SupervisorJob() + dispatcher)
private val eventProducers: MutableList<EventProducer> = mutableListOf()

init {
Expand Down

0 comments on commit d75229a

Please sign in to comment.