summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-05 16:53:35 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-12 09:15:07 +0200
commit5096c119ab731dee1a1ef52dc36998272d34d875 (patch)
treec600750a1e98dbb6fa6355879e62909183af360f
parentFix path for lobby/updateSettings (diff)
downloadseven-wonders-5096c119ab731dee1a1ef52dc36998272d34d875.tar.gz
seven-wonders-5096c119ab731dee1a1ef52dc36998272d34d875.tar.bz2
seven-wonders-5096c119ab731dee1a1ef52dc36998272d34d875.zip
Use start UNDISPATCHED intead of yield after launch
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt5
1 files changed, 2 insertions, 3 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt
index ed616636..3c66d31e 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt
@@ -2,7 +2,6 @@ package org.luxons.sevenwonders.ui.redux.sagas
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
-import kotlinx.coroutines.yield
import org.luxons.sevenwonders.client.SevenWondersClient
import org.luxons.sevenwonders.client.SevenWondersSession
import org.luxons.sevenwonders.ui.redux.RequestChooseName
@@ -15,15 +14,15 @@ import redux.WrapperAction
typealias SwSagaContext = SagaContext<SwState, RAction, WrapperAction>
+@OptIn(ExperimentalCoroutinesApi::class)
suspend fun SwSagaContext.rootSaga() = coroutineScope {
val action = next<RequestChooseName>()
val session = SevenWondersClient().connect("localhost:8000")
console.info("Connected to Seven Wonders web socket API")
- launch {
+ launch(start = CoroutineStart.UNDISPATCHED) {
serverErrorSaga(session)
}
- yield() // ensures the error saga starts
val player = session.chooseName(action.playerName)
dispatch(SetCurrentPlayerAction(player))
bgstack15