live configure API timeline entries
parent
a610196293
commit
2e6e9b5dcf
|
@ -91,6 +91,12 @@ final class Env(
|
|||
|
||||
def net = common.netConfig
|
||||
|
||||
lazy val apiTimelineSetting = memo.settingStore[Int](
|
||||
"apiTimelineEntries",
|
||||
default = 10,
|
||||
text = "API timeline entries to serve".some
|
||||
)
|
||||
|
||||
lazy val preloader = wire[mashup.Preload]
|
||||
lazy val socialInfo = wire[mashup.UserInfo.SocialApi]
|
||||
lazy val userNbGames = wire[mashup.UserInfo.NbGamesApi]
|
||||
|
|
|
@ -16,7 +16,8 @@ final class Dev(env: Env) extends LilaController(env) {
|
|||
env.report.slackScoreThresholdSetting,
|
||||
env.streamer.alwaysFeaturedSetting,
|
||||
env.rating.ratingFactorsSetting,
|
||||
env.plan.donationGoalSetting
|
||||
env.plan.donationGoalSetting,
|
||||
env.apiTimelineSetting
|
||||
)
|
||||
|
||||
def settings = Secure(_.Settings) { implicit ctx => _ =>
|
||||
|
|
|
@ -26,7 +26,7 @@ final class Timeline(env: Env) extends LilaController(env) {
|
|||
.map { html.timeline.more(_) },
|
||||
_ =>
|
||||
env.timeline.entryApi
|
||||
.moreUserEntries(me.id, nb atMost 20)
|
||||
.moreUserEntries(me.id, nb atMost env.apiTimelineSetting.get())
|
||||
.logTimeIfGt(s"timeline mobile $nb for ${me.id}", 10 seconds)
|
||||
.map { es =>
|
||||
Ok(Json.obj("entries" -> es))
|
||||
|
|
|
@ -27,7 +27,7 @@ final class EntryApi(
|
|||
userEntries(userId, nb) flatMap broadcast.interleave
|
||||
|
||||
private def userEntries(userId: User.ID, max: Max): Fu[Vector[Entry]] =
|
||||
coll
|
||||
(max.value > 0) ?? coll
|
||||
.find(
|
||||
$doc(
|
||||
"users" -> userId,
|
||||
|
|
Loading…
Reference in New Issue