Skip to content

Commit

Permalink
Revert "keep track of hot rooms, with unusual number of members"
Browse files Browse the repository at this point in the history
This reverts commit 4cf7a07.

No use for it just yet
  • Loading branch information
ornicar committed Dec 10, 2024
1 parent 4cf7a07 commit 3a9c539
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/main/scala/RoomCrowd.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lila.ws

import java.util.concurrent.ConcurrentHashMap
import com.github.blemale.scaffeine.Scaffeine

import ipc.*

Expand Down Expand Up @@ -50,7 +49,6 @@ final class RoomCrowd(json: CrowdJson, groupedWithin: util.GroupedWithin)(using
crowds.updated(crowd.roomId, crowd)
.values
lastPerRoomId.foreach: output =>
RoomCrowd.hot.put(output.roomId, output.members)
json
.room(output)
.foreach:
Expand All @@ -60,11 +58,9 @@ final class RoomCrowd(json: CrowdJson, groupedWithin: util.GroupedWithin)(using

object RoomCrowd:

type Members = Int

case class Output(
roomId: RoomId,
members: Members,
members: Int,
users: Iterable[User.Id],
anons: Int
)
Expand All @@ -91,13 +87,3 @@ object RoomCrowd:
def disconnect(user: Option[User.Id]) =
user.fold(copy(anons = anons - 1)): u =>
copy(users = users.updatedWith(u)(_.map(_ - 1).filter(_ > 0)))

// rooms that have an abnormal amount of members
object hot:
private val rooms = Scaffeine()
.expireAfterWrite(1.minute)
.build[RoomId, Members]()
def get(roomId: RoomId) = rooms.getIfPresent(roomId)
def put(roomId: RoomId, nb: Members) =
println(s"hot room put $roomId $nb")
if nb > 1000 then rooms.put(roomId, nb)

0 comments on commit 3a9c539

Please sign in to comment.