can't get the top 50 online players? who cares
parent
e2e1b524fc
commit
cd1188d467
|
@ -145,7 +145,7 @@ object User extends LilaController {
|
|||
val max = 50
|
||||
negotiate(
|
||||
html = notFound,
|
||||
api = _ => env.cached.top50Online.get map { list =>
|
||||
api = _ => env.cached.getTop50Online map { list =>
|
||||
Ok(Json.toJson(list.take(getInt("nb").fold(10)(_ min max)).map(env.jsonView(_))))
|
||||
}
|
||||
)
|
||||
|
@ -192,7 +192,7 @@ object User extends LilaController {
|
|||
// }
|
||||
// }
|
||||
tourneyWinners ← Env.tournament.winners.all.map(_.top)
|
||||
online ← env.cached.top50Online.get
|
||||
online ← env.cached.getTop50Online
|
||||
_ <- Env.user.lightUserApi preloadMany tourneyWinners.map(_.userId)
|
||||
res <- negotiate(
|
||||
html = fuccess(Ok(html.user.list(
|
||||
|
|
|
@ -33,7 +33,7 @@ final class Env(
|
|||
tournamentApi.allCurrentLeadersInStandard flatMap api.requests.fromTournamentLeaders
|
||||
}
|
||||
scheduler.future(15 minutes, "irwin leaderboards") {
|
||||
userCache.top50Online.get flatMap api.requests.fromLeaderboard
|
||||
userCache.getTop50Online flatMap api.requests.fromLeaderboard
|
||||
}
|
||||
|
||||
system.lilaBus.subscribe(system.actorOf(Props(new Actor {
|
||||
|
|
|
@ -85,12 +85,14 @@ final class Cached(
|
|||
keyToString = _.toString
|
||||
)
|
||||
|
||||
val top50Online = asyncCache.single[List[User]](
|
||||
private val top50Online = asyncCache.single[List[User]](
|
||||
name = "user.top50online",
|
||||
f = UserRepo.byIdsSortRating(onlineUserIdMemo.keys, 50),
|
||||
expireAfter = _.ExpireAfterWrite(10 seconds)
|
||||
)
|
||||
|
||||
def getTop50Online = top50Online.get.nevermind
|
||||
|
||||
object ranking {
|
||||
|
||||
def getAll(userId: User.ID): Fu[Map[Perf.Key, Int]] =
|
||||
|
|
|
@ -90,7 +90,7 @@ object UserRepo {
|
|||
)
|
||||
.sort($doc(s"perfs.standard.gl.r" -> -1))
|
||||
.list[Bdoc](nb, ReadPreference.secondaryPreferred).map {
|
||||
_.flatMap { _.getAs[String]("_id") }
|
||||
_.flatMap { _.getAs[User.ID]("_id") }
|
||||
}
|
||||
|
||||
private[user] def allSortToints(nb: Int) =
|
||||
|
|
Loading…
Reference in New Issue