lila/modules/perfStat/src/main/Env.scala

41 lines
1.0 KiB
Scala
Raw Normal View History

2015-12-22 09:08:36 -07:00
package lila.perfStat
import akka.actor._
2019-11-30 18:00:44 -07:00
import com.softwaremill.macwire._
2021-09-19 04:13:53 -06:00
import com.softwaremill.tagging._
2019-11-30 18:00:44 -07:00
import play.api.Configuration
2015-12-22 09:08:36 -07:00
2019-11-30 18:00:44 -07:00
import lila.common.config._
2015-12-22 09:08:36 -07:00
2021-06-30 00:45:20 -06:00
@Module
2015-12-22 09:08:36 -07:00
final class Env(
lightUser: lila.common.LightUser.GetterSync,
2021-06-30 00:45:20 -06:00
lightUserApi: lila.user.LightUserApi,
2019-11-30 18:00:44 -07:00
gameRepo: lila.game.GameRepo,
2021-06-30 00:45:20 -06:00
userRepo: lila.user.UserRepo,
rankingsOf: lila.user.RankingsOf,
rankingApi: lila.user.RankingApi,
2021-09-19 04:13:53 -06:00
yoloDb: lila.db.AsyncDb @@ lila.db.YoloDb
2020-06-24 03:37:18 -06:00
)(implicit
ec: scala.concurrent.ExecutionContext,
system: ActorSystem
) {
2015-12-22 09:08:36 -07:00
2021-06-30 00:45:20 -06:00
private lazy val storage = new PerfStatStorage(
2021-09-19 04:13:53 -06:00
coll = yoloDb(CollName("perf_stat")).failingSilently()
)
2015-12-22 09:08:36 -07:00
2019-11-30 18:00:44 -07:00
lazy val indexer = wire[PerfStatIndexer]
2021-06-30 00:45:20 -06:00
lazy val api = wire[PerfStatApi]
2015-12-25 03:41:45 -07:00
2021-06-30 00:45:20 -06:00
lazy val jsonView = wire[JsonView]
2015-12-23 20:41:28 -07:00
2019-11-29 17:07:51 -07:00
lila.common.Bus.subscribeFun("finishGame") {
case lila.game.actorApi.FinishGame(game, _, _) if !game.aborted =>
indexer addGame game addFailureEffect { e =>
lila.log("perfStat").error(s"index game ${game.id}", e)
} unit
}
2015-12-22 09:08:36 -07:00
}