cache hook computations

This commit is contained in:
Thibault Duplessis 2016-12-05 18:16:22 +01:00
parent bb27550595
commit 1a0ab4278c
2 changed files with 3 additions and 3 deletions

View file

@ -54,7 +54,7 @@ case class Hook(
def rating = user flatMap { u => perfType map (_.key) flatMap u.ratingMap.get }
def engine = user ?? (_.engine)
def render: JsObject = Json.obj(
lazy val render: JsObject = Json.obj(
"id" -> id,
"uid" -> uid,
"u" -> user.map(_.username),
@ -72,7 +72,7 @@ case class Hook(
def randomColor = color == "random"
def poolCompatible =
lazy val poolCompatible =
realMode.rated && realVariant.standard && randomColor &&
lila.pool.PoolList.clockStringSet.contains(clock.show)

View file

@ -136,7 +136,7 @@ private[lobby] final class Socket(
case HookSub(member, true) => hookSubscriberUids += member.uid
case HookSub(member, false) => hookSubscriberUids -= member.uid
case AllHooksFor(member, hooks) =>
notifyMember("hooks", JsArray(hooks map (_.render)))(member)
notifyMember("hooks", JsArray(hooks.map(_.render)))(member)
hookSubscriberUids += member.uid
}