diff options
author | Joffrey Bion <joffrey.bion@gmail.com> | 2021-09-08 09:13:15 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@gmail.com> | 2021-09-08 09:13:15 +0200 |
commit | 6acf7c91a6f30f6b16bb54f4b2c173383c521149 (patch) | |
tree | ad96410fcea54877fa5d7b19a43b8a378ea72f88 /sw-ui | |
parent | Remove usages of deprecated route extensions (diff) | |
download | seven-wonders-6acf7c91a6f30f6b16bb54f4b2c173383c521149.tar.gz seven-wonders-6acf7c91a6f30f6b16bb54f4b2c173383c521149.tar.bz2 seven-wonders-6acf7c91a6f30f6b16bb54f4b2c173383c521149.zip |
OptIn GlobalScope usage in SagasFramework
Diffstat (limited to 'sw-ui')
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFramework.kt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFramework.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFramework.kt index ea3fc26e..22377512 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFramework.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFramework.kt @@ -2,6 +2,7 @@ package org.luxons.sevenwonders.ui.redux.sagas import kotlinx.coroutines.* import kotlinx.coroutines.channels.BroadcastChannel +import kotlinx.coroutines.channels.Channel.Factory.BUFFERED import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import redux.Middleware @@ -14,7 +15,7 @@ class SagaManager<S, A : RAction, R>( ) { private lateinit var context: SagaContext<S, A, R> - private val actions = BroadcastChannel<A>(16) + private val actions = BroadcastChannel<A>(BUFFERED) fun createMiddleware(): Middleware<S, A, R, A, R> = ::sagasMiddleware @@ -34,6 +35,7 @@ class SagaManager<S, A : RAction, R>( monitor?.invoke(action) } + @OptIn(DelicateCoroutinesApi::class) // Ok because almost never suspends - if it does, we have bigger problems private fun handleAction(action: A) { GlobalScope.launch { actions.send(action) } } |