remove dead code, count rounds less often
This commit is contained in:
parent
9b51a2196f
commit
f19f7a0c2e
|
@ -26,7 +26,7 @@ final class Env(
|
|||
nowPlaying = Env.round.nowPlaying,
|
||||
dailyPuzzle = Env.puzzle.daily,
|
||||
streamsOnAir = () => Env.tv.streamsOnAir,
|
||||
countRounds = () => Env.round.count(true))
|
||||
countRounds = Env.round.count)
|
||||
|
||||
lazy val userInfo = mashup.UserInfo(
|
||||
countUsers = () => Env.user.countEnabled,
|
||||
|
|
|
@ -31,7 +31,7 @@ final class Preload(
|
|||
nowPlaying: (User, Int) => Fu[List[Pov]],
|
||||
streamsOnAir: => () => Fu[List[StreamOnAir]],
|
||||
dailyPuzzle: () => Fu[Option[lila.puzzle.DailyPuzzle]],
|
||||
countRounds: () => Fu[Int]) {
|
||||
countRounds: () => Int) {
|
||||
|
||||
private type Response = (JsObject, List[Entry], List[MiniForumPost], List[Enterable], Option[Game], List[(User, PerfType)], List[Winner], Option[lila.puzzle.DailyPuzzle], List[Pov], List[StreamOnAir], Int)
|
||||
|
||||
|
@ -49,13 +49,12 @@ final class Preload(
|
|||
dailyPuzzle() zip
|
||||
(ctx.me ?? { nowPlaying(_, 3) }) zip
|
||||
filter zip
|
||||
streamsOnAir() zip
|
||||
countRounds() map {
|
||||
case (((((((((((hooks, posts), tours), feat), entries), lead), tWinners), puzzle), playing), filter), streams), nbRounds) =>
|
||||
streamsOnAir() map {
|
||||
case ((((((((((hooks, posts), tours), feat), entries), lead), tWinners), puzzle), playing), filter), streams) =>
|
||||
(Json.obj(
|
||||
"version" -> lobbyVersion(),
|
||||
"pool" -> JsArray(hooks map (_.render)),
|
||||
"filter" -> filter.render
|
||||
), entries, posts, tours, feat, lead, tWinners, puzzle, playing, streams, nbRounds)
|
||||
), entries, posts, tours, feat, lead, tWinners, puzzle, playing, streams, countRounds())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ trait ActorMap extends Actor {
|
|||
|
||||
case Ask(id, msg) => getOrMake(id) forward msg
|
||||
|
||||
case Size => sender ! size
|
||||
|
||||
case Terminated(actor) =>
|
||||
context unwatch actor
|
||||
actors foreach {
|
||||
|
|
|
@ -32,7 +32,6 @@ case class Get(id: String)
|
|||
case class Tell(id: String, msg: Any)
|
||||
case class TellAll(msg: Any)
|
||||
case class Ask(id: String, msg: Any)
|
||||
case object Size
|
||||
}
|
||||
|
||||
case class WithUserIds(f: Iterable[String] => Unit)
|
||||
|
|
|
@ -9,7 +9,6 @@ import akka.pattern.{ ask, pipe }
|
|||
import play.api.libs.concurrent._
|
||||
|
||||
import actorApi._
|
||||
import lila.hub.actorApi.map.Size
|
||||
import lila.hub.actorApi.monitor._
|
||||
import lila.hub.actorApi.round.MoveEvent
|
||||
import lila.socket.actorApi.{ NbMembers, PopulationGet }
|
||||
|
@ -30,7 +29,6 @@ private[monitor] final class Reporting(
|
|||
}
|
||||
|
||||
var nbMembers = 0
|
||||
var nbGames = 0
|
||||
var nbPlaying = 0
|
||||
var loadAvg = 0f
|
||||
var nbThreads = 0
|
||||
|
@ -66,13 +64,11 @@ private[monitor] final class Reporting(
|
|||
case _ => {
|
||||
val before = nowMillis
|
||||
MongoStatus(db.db)(mongoStatus) zip
|
||||
(hub.socket.round ? Size).mapTo[Int] zip
|
||||
(hub.actor.game ? lila.hub.actorApi.game.Count).mapTo[Int] onComplete {
|
||||
case Failure(e) => logwarn("[reporting] " + e.getMessage)
|
||||
case Success(((mongoS, gameHubs), games)) => {
|
||||
case Success((mongoS, games)) => {
|
||||
latency = (nowMillis - before).toInt
|
||||
mongoStatus = mongoS
|
||||
nbGames = games
|
||||
loadAvg = osStats.getSystemLoadAverage.toFloat
|
||||
nbThreads = threadStats.getThreadCount
|
||||
memory = memoryStats.getHeapMemoryUsage.getUsed / 1024 / 1024
|
||||
|
|
|
@ -65,13 +65,14 @@ final class Env(
|
|||
moretimeDuration = Moretime,
|
||||
activeTtl = ActiveTtl)
|
||||
def receive: Receive = ({
|
||||
case actorApi.BroadcastSize => hub.socket.lobby ! lila.hub.actorApi.round.NbRounds(size)
|
||||
case actorApi.GetNbRounds =>
|
||||
nbRounds = size
|
||||
hub.socket.lobby ! lila.hub.actorApi.round.NbRounds(nbRounds)
|
||||
}: Receive) orElse actorMapReceive
|
||||
}), name = ActorMapName)
|
||||
|
||||
val count = AsyncCache.single(
|
||||
f = roundMap ? lila.hub.actorApi.map.Size mapTo manifest[Int],
|
||||
timeToLive = 1 second)
|
||||
private var nbRounds = 0
|
||||
def count() = nbRounds
|
||||
|
||||
private val socketHub = {
|
||||
val actor = system.actorOf(
|
||||
|
@ -172,7 +173,7 @@ final class Env(
|
|||
titivate.finishAbandoned
|
||||
}
|
||||
|
||||
scheduler.message(1.3 seconds)(roundMap -> actorApi.BroadcastSize)
|
||||
scheduler.message(2.1 seconds)(roundMap -> actorApi.GetNbRounds)
|
||||
}
|
||||
|
||||
private lazy val titivate = new Titivate(roundMap, scheduler)
|
||||
|
|
|
@ -127,4 +127,4 @@ case class Cheat(color: Color)
|
|||
case class HoldAlert(playerId: String, mean: Int, sd: Int)
|
||||
}
|
||||
|
||||
private[round] case object BroadcastSize
|
||||
private[round] case object GetNbRounds
|
||||
|
|
Loading…
Reference in a new issue