diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-12 16:18:28 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-12 16:18:28 +0100 |
commit | 71f2fc4f25bdfdeac7db9b8e62144c3110e3bf6a (patch) | |
tree | d8a88a126c74d3a36177980be4259b1a173fa1aa /sw-client/src/commonMain/kotlin | |
parent | Fix race in blinking test (diff) | |
download | seven-wonders-71f2fc4f25bdfdeac7db9b8e62144c3110e3bf6a.tar.gz seven-wonders-71f2fc4f25bdfdeac7db9b8e62144c3110e3bf6a.tar.bz2 seven-wonders-71f2fc4f25bdfdeac7db9b8e62144c3110e3bf6a.zip |
Fix race conditions for game start and tests
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/70
Diffstat (limited to 'sw-client/src/commonMain/kotlin')
-rw-r--r-- | sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt index 6cc50f44..02f7f2da 100644 --- a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt +++ b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt @@ -122,10 +122,8 @@ class SevenWondersSession(private val stompSession: StompSessionWithKxSerializat suspend fun watchLobbyUpdates(): Flow<LobbyDTO> = stompSession.subscribe("/user/queue/lobby/updated", LobbyDTO.serializer()) - suspend fun awaitGameStart(gameId: Long): PlayerTurnInfo { - val startEvents = stompSession.subscribe("/user/queue/lobby/$gameId/started", PlayerTurnInfo.serializer()) - return startEvents.first() - } + suspend fun watchGameStarted(): Flow<PlayerTurnInfo> = + stompSession.subscribe("/user/queue/lobby/started", PlayerTurnInfo.serializer()) suspend fun startGame() { stompSession.sendEmptyMsg("/app/lobby/startGame") |