Skip to content

Commit

Permalink
feat: add logging on if there are active rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
iyzana committed Feb 10, 2024
1 parent a263165 commit 23616e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/src/main/kotlin/de/randomerror/ytsync/Room.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ fun createRoom(session: Session, roomId: RoomId = generateRoomId()): String {
if (sessions[session] != null) throw Disconnect()
if (rooms.containsKey(roomId)) throw Disconnect("server full")
val room = Room(mutableListOf(User(session)))
if (rooms.isEmpty()) {
logger.info("active rooms")
}
rooms[roomId] = room
sessions[session] = roomId
session.remote.sendStringByFuture("create ${roomId.roomId}")
Expand Down Expand Up @@ -94,6 +97,9 @@ private fun scheduleRoomClose(
if (roomId.roomId != "test") {
logger.info("room statistic: ${room.maxConcurentUsers} users, ${room.numQueuedVideos} videos")
}
if (rooms.isEmpty()) {
logger.info("no more active rooms")
}
}
}

Expand Down

0 comments on commit 23616e8

Please sign in to comment.