cache timeout
This commit is contained in:
parent
4807f7473e
commit
54e5947d46
|
@ -2,10 +2,10 @@ package lila.user
|
|||
|
||||
import org.joda.time.DateTime
|
||||
import play.api.libs.iteratee._
|
||||
import reactivemongo.api.{ Cursor, ReadPreference }
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ Match, Project, Group, GroupField, SumField, SumValue }
|
||||
import reactivemongo.api.Cursor
|
||||
import reactivemongo.api.ReadPreference
|
||||
import reactivemongo.api.{ Cursor, ReadPreference }
|
||||
import reactivemongo.bson._
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
@ -80,7 +80,8 @@ final class RankingApi(
|
|||
private val cache = AsyncCache[Perf.ID, Map[User.ID, Rank]](
|
||||
name = "rankingApi.weeklyStableRanking",
|
||||
f = compute,
|
||||
timeToLive = 15 minutes)
|
||||
timeToLive = 15 minutes,
|
||||
resultTimeout = 10 seconds)
|
||||
|
||||
private def compute(perfId: Perf.ID): Fu[Map[User.ID, Rank]] =
|
||||
coll.find(
|
||||
|
@ -113,7 +114,8 @@ final class RankingApi(
|
|||
lila.rating.PerfType(perfId).exists(lila.rating.PerfType.leaderboardable.contains) ?? {
|
||||
coll.aggregate(
|
||||
Match($doc("perf" -> perfId)),
|
||||
List(Project($doc(
|
||||
List(
|
||||
Project($doc(
|
||||
"_id" -> false,
|
||||
"r" -> $doc(
|
||||
"$subtract" -> $arr(
|
||||
|
|
Loading…
Reference in a new issue