Skip to content

Commit

Permalink
GH-168 Last is still a replay
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemke committed Jan 15, 2021
1 parent 52b0cd5 commit d15efce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ constructor(private val gameService: GameService, private val userService: UserS
val emitter = sseEmitterFactory.createInstance(1000 * 60 * 4)
var emissions = 0
val emit = { data: String, isLast: Boolean ->
emitter.send("EVENT", data)
logger.info("Emitted game stats event of length ${data.length} to game $gameId")
if (isLast) {
emitter.send("DONE", "DONE")
emitter.complete()
} else {
emitter.send("EVENT", data)
logger.info("Emitted game stats event of length ${data.length} to game $gameId")
}
}
val subscription = GameStatSubscription(gameId, emit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.cwtsite.cwt.domain.game.view

import com.cwtsite.cwt.controller.RestException
import com.cwtsite.cwt.core.ClockInstance
import com.cwtsite.cwt.core.event.SseEmitterFactory
Expand Down Expand Up @@ -169,7 +168,6 @@ class GameRestControllerTest {
@Test
fun listenToStats() {
val game = EntityDefaults.game()
game.replayQuantity = 3
val sseEmitter = mock(SseEmitterWrapper::class.java)
`when`(sseEmitterFactory.createInstance(anyLong())).thenReturn(sseEmitter)
cut.listenToStats(game.id!!)
Expand Down

0 comments on commit d15efce

Please sign in to comment.