rename lobbyActor
parent
ae01daf9ba
commit
4614a3421f
|
@ -5,13 +5,13 @@ import lila.game.{ Pov, Source }
|
||||||
final private class AbortListener(
|
final private class AbortListener(
|
||||||
userRepo: lila.user.UserRepo,
|
userRepo: lila.user.UserRepo,
|
||||||
seekApi: SeekApi,
|
seekApi: SeekApi,
|
||||||
lobbyTrouper: LobbySyncActor
|
lobbyActor: LobbySyncActor
|
||||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||||
|
|
||||||
def apply(pov: Pov): Funit =
|
def apply(pov: Pov): Funit =
|
||||||
(pov.game.isCorrespondence ?? recreateSeek(pov)) >>-
|
(pov.game.isCorrespondence ?? recreateSeek(pov)) >>-
|
||||||
cancelColorIncrement(pov) >>-
|
cancelColorIncrement(pov) >>-
|
||||||
lobbyTrouper.registerAbortedGame(pov.game)
|
lobbyActor.registerAbortedGame(pov.game)
|
||||||
|
|
||||||
private def cancelColorIncrement(pov: Pov): Unit =
|
private def cancelColorIncrement(pov: Pov): Unit =
|
||||||
if (pov.game.source.exists(s => s == Source.Lobby || s == Source.Pool)) pov.game.userIds match {
|
if (pov.game.source.exists(s => s == Source.Lobby || s == Source.Pool)) pov.game.userIds match {
|
||||||
|
|
|
@ -209,7 +209,7 @@ private object LobbySyncActor {
|
||||||
makeTrouper: () => LobbySyncActor
|
makeTrouper: () => LobbySyncActor
|
||||||
)(implicit ec: scala.concurrent.ExecutionContext, system: akka.actor.ActorSystem) = {
|
)(implicit ec: scala.concurrent.ExecutionContext, system: akka.actor.ActorSystem) = {
|
||||||
val trouper = makeTrouper()
|
val trouper = makeTrouper()
|
||||||
Bus.subscribe(trouper, "lobbyTrouper")
|
Bus.subscribe(trouper, "lobbyActor")
|
||||||
system.scheduler.scheduleWithFixedDelay(15 seconds, resyncIdsPeriod)(() => trouper ! actorApi.Resync)
|
system.scheduler.scheduleWithFixedDelay(15 seconds, resyncIdsPeriod)(() => trouper ! actorApi.Resync)
|
||||||
lila.common.ResilientScheduler(
|
lila.common.ResilientScheduler(
|
||||||
every = Every(broomPeriod),
|
every = Every(broomPeriod),
|
||||||
|
|
|
@ -13,13 +13,13 @@ final private class HookThieve()(implicit
|
||||||
|
|
||||||
def candidates(clock: chess.Clock.Config): Fu[PoolHooks] =
|
def candidates(clock: chess.Clock.Config): Fu[PoolHooks] =
|
||||||
Bus
|
Bus
|
||||||
.ask[PoolHooks]("lobbyTrouper")(GetCandidates(clock, _))
|
.ask[PoolHooks]("lobbyActor")(GetCandidates(clock, _))
|
||||||
.logFailure(logger)
|
.logFailure(logger)
|
||||||
.recoverDefault(PoolHooks(Vector.empty))
|
.recoverDefault(PoolHooks(Vector.empty))
|
||||||
|
|
||||||
def stolen(poolHooks: Vector[PoolHook], monId: String) = {
|
def stolen(poolHooks: Vector[PoolHook], monId: String) = {
|
||||||
lila.mon.lobby.pool.thieve.stolen(monId).record(poolHooks.size)
|
lila.mon.lobby.pool.thieve.stolen(monId).record(poolHooks.size)
|
||||||
if (poolHooks.nonEmpty) Bus.publish(StolenHookIds(poolHooks.map(_.hookId)), "lobbyTrouper")
|
if (poolHooks.nonEmpty) Bus.publish(StolenHookIds(poolHooks.map(_.hookId)), "lobbyActor")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ final private[setup] class Processor(
|
||||||
config.hook(sri, ctx.me, sid, blocking) match {
|
config.hook(sri, ctx.me, sid, blocking) match {
|
||||||
case Left(hook) =>
|
case Left(hook) =>
|
||||||
fuccess {
|
fuccess {
|
||||||
Bus.publish(AddHook(hook), "lobbyTrouper")
|
Bus.publish(AddHook(hook), "lobbyActor")
|
||||||
Created(hook.id)
|
Created(hook.id)
|
||||||
}
|
}
|
||||||
case Right(Some(seek)) =>
|
case Right(Some(seek)) =>
|
||||||
|
@ -57,7 +57,7 @@ final private[setup] class Processor(
|
||||||
import Processor.HookResult._
|
import Processor.HookResult._
|
||||||
if (maxPlaying <= nbPlaying) Refused
|
if (maxPlaying <= nbPlaying) Refused
|
||||||
else {
|
else {
|
||||||
Bus.publish(AddSeek(seek), "lobbyTrouper")
|
Bus.publish(AddSeek(seek), "lobbyActor")
|
||||||
Created(seek.id)
|
Created(seek.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue