preload user games' tournaments

This commit is contained in:
Thibault Duplessis 2017-01-26 17:56:30 +01:00
parent 08fb8c7aff
commit 5807044640
2 changed files with 2 additions and 1 deletions

View file

@ -108,6 +108,7 @@ object User extends LilaController {
me = ctx.me,
page = page)(ctx.body)
_ <- Env.user.lightUserApi preloadMany pag.currentPageResults.flatMap(_.userIds)
_ <- Env.tournament.cached.nameCache preloadMany pag.currentPageResults.flatMap(_.tournamentId)
_ <- Env.team.cached.nameCache preloadSet info.teamIds
relation <- ctx.userId ?? { relationApi.fetchRelation(_, u.id) }
notes <- ctx.me ?? { me =>

View file

@ -8,7 +8,7 @@ private[tournament] final class Cached(
createdTtl: FiniteDuration,
rankingTtl: FiniteDuration)(implicit system: akka.actor.ActorSystem) {
private val nameCache = new Syncache[String, Option[String]](
val nameCache = new Syncache[String, Option[String]](
name = "tournament.name",
compute = id => TournamentRepo byId id map2 { (tour: Tournament) => tour.fullName },
default = _ => none,