remove tournament room when wiping out tournament
This commit is contained in:
parent
ba859b4d13
commit
7ad799c871
|
@ -28,4 +28,8 @@ class RoomRepo(collection: MongoCollection)
|
|||
def insertIO(room: Room) = io {
|
||||
insert(room)
|
||||
}
|
||||
|
||||
def removeIO(id: String): IO[Unit] = io {
|
||||
remove(DBObject("_id" -> id))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import lobby.{ Socket ⇒ LobbySocket }
|
|||
|
||||
private[tournament] final class TournamentApi(
|
||||
repo: TournamentRepo,
|
||||
roomRepo: RoomRepo,
|
||||
joiner: GameJoiner,
|
||||
socket: Socket,
|
||||
siteSocket: site.Socket,
|
||||
|
@ -58,6 +59,7 @@ private[tournament] final class TournamentApi(
|
|||
|
||||
def wipeEmpty(created: Created): IO[Unit] = (for {
|
||||
_ ← repo removeIO created
|
||||
_ ← roomRepo removeIO created.id
|
||||
_ ← reloadSiteSocket
|
||||
_ ← lobbyReload
|
||||
_ ← removeLobbyMessage(created)
|
||||
|
|
|
@ -39,6 +39,7 @@ final class TournamentEnv(
|
|||
|
||||
lazy val api = new TournamentApi(
|
||||
repo = repo,
|
||||
roomRepo = roomRepo,
|
||||
joiner = joiner,
|
||||
socket = socket,
|
||||
siteSocket = siteSocket,
|
||||
|
|
Loading…
Reference in a new issue