new actor map for round socket hub
parent
2a1dc5f360
commit
05e7c16a9a
|
@ -411,7 +411,7 @@ round {
|
|||
ragequit.timeout = 10 seconds
|
||||
}
|
||||
socket {
|
||||
name = round-socket
|
||||
name = round-socket-front
|
||||
timeout = 30 seconds
|
||||
}
|
||||
channel.move_time.name = round-move-time-channel
|
||||
|
|
|
@ -25,7 +25,7 @@ final class Env(
|
|||
lazy val analyser = new Analyser(
|
||||
indexer = indexer,
|
||||
requesterApi = requesterApi,
|
||||
roundSocket = hub.socket.round,
|
||||
roundSocket = hub.socket.roundActor,
|
||||
studyActor = hub.actor.study,
|
||||
bus = system.lilaBus
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ final class Env(
|
|||
lazy val gameStateStream = new GameStateStream(
|
||||
system,
|
||||
jsonView,
|
||||
hub.socket.round
|
||||
hub.socket.roundActor
|
||||
)
|
||||
|
||||
lazy val player = new BotPlayer(hub.actor.chat)(system)
|
||||
|
|
|
@ -61,7 +61,7 @@ final class Env(
|
|||
import lila.hub.actorApi.map.Exists
|
||||
import akka.pattern.ask
|
||||
import makeTimeout.short
|
||||
hub.socket.round ? Exists(id) mapTo manifest[Boolean]
|
||||
hub.socket.roundActor ? Exists(id) mapTo manifest[Boolean]
|
||||
},
|
||||
clientVersion = clientVersion,
|
||||
offlineMode = OfflineMode,
|
||||
|
|
|
@ -35,7 +35,7 @@ final class Env(config: Config, system: ActorSystem) {
|
|||
|
||||
object socket {
|
||||
val lobby = select("socket.lobby")
|
||||
val round = select("socket.round")
|
||||
val roundActor = select("socket.round")
|
||||
val site = select("socket.site")
|
||||
val hub = select("socket.hub")
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ object Env {
|
|||
db = lila.db.Env.current,
|
||||
system = lila.common.PlayApp.system,
|
||||
getLightUser = lila.user.Env.current.lightUserSync,
|
||||
roundSocketHub = lila.hub.Env.current.socket.round,
|
||||
roundSocketHub = lila.hub.Env.current.socket.roundActor,
|
||||
scheduler = lila.common.PlayApp.scheduler,
|
||||
config = lila.common.PlayApp loadConfig "push"
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package lila.round
|
||||
|
||||
import akka.actor._
|
||||
import akka.pattern.ask
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import play.api.libs.iteratee._
|
||||
import reactivemongo.api._
|
||||
|
@ -15,7 +15,7 @@ import makeTimeout.short
|
|||
|
||||
private final class CorresAlarm(
|
||||
coll: Coll,
|
||||
roundSocketHub: ActorSelection
|
||||
socketHub: lila.hub.ActorMapNew
|
||||
) extends Actor {
|
||||
|
||||
object Schedule
|
||||
|
@ -56,7 +56,7 @@ private final class CorresAlarm(
|
|||
case (count, alarm) => GameRepo.game(alarm._id).flatMap {
|
||||
_ ?? { game =>
|
||||
val pov = Pov(game, game.turnColor)
|
||||
roundSocketHub ? Ask(pov.gameId, IsOnGame(pov.color)) mapTo manifest[Boolean] addEffect {
|
||||
socketHub.ask[Boolean](pov.gameId, IsOnGame(pov.color)) addEffect {
|
||||
case true => // already looking at the game
|
||||
case false => context.system.lilaBus.publish(
|
||||
lila.game.actorApi.CorresAlarmEvent(pov),
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package lila.round
|
||||
|
||||
import akka.actor._
|
||||
import akka.pattern.ask
|
||||
import akka.pattern.{ ask, pipe }
|
||||
import com.typesafe.config.Config
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import actorApi.{ GetSocketStatus, SocketStatus }
|
||||
|
||||
import lila.game.{ Game, GameRepo, Pov }
|
||||
import lila.hub.actorApi.map.{ Ask, Tell }
|
||||
import lila.hub.actorApi.map.{ Tell, Exists, Ask }
|
||||
import lila.hub.actorApi.round.{ Abort, Resign, FishnetPlay }
|
||||
import lila.hub.actorApi.{ HasUserId, DeployPost }
|
||||
|
||||
|
@ -128,6 +128,11 @@ final class Env(
|
|||
logger.warn("Disabling round history persistence!")
|
||||
historyPersistenceEnabled = false
|
||||
}
|
||||
case Tell(id, msg) => socketHub.tell(id, msg)
|
||||
case Exists(id) => sender ! socketHub.exists(id)
|
||||
case Ask(id, msg) =>
|
||||
import makeTimeout.short
|
||||
socketHub.getOrMake(id) ? msg pipeTo sender
|
||||
}
|
||||
}), name = SocketName)
|
||||
bus.subscribe(socketHubActor, 'tvSelect, 'startGame, 'deploy)
|
||||
|
@ -232,7 +237,7 @@ final class Env(
|
|||
)
|
||||
|
||||
bus.subscribe(system.actorOf(
|
||||
Props(new CorresAlarm(db(CollectionAlarm), hub.socket.round)),
|
||||
Props(new CorresAlarm(db(CollectionAlarm), socketHub)),
|
||||
name = "corres-alarm"
|
||||
), 'moveEventCorres, 'finishGame)
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ final class Env(
|
|||
flood: lila.security.Flood,
|
||||
hub: lila.hub.Env,
|
||||
roundMap: DuctMap[_],
|
||||
roundSocketHub: ActorSelection,
|
||||
lightUserApi: lila.user.LightUserApi,
|
||||
isOnline: String => Boolean,
|
||||
onStart: String => Unit,
|
||||
|
@ -217,7 +216,6 @@ object Env {
|
|||
flood = lila.security.Env.current.flood,
|
||||
hub = lila.hub.Env.current,
|
||||
roundMap = lila.round.Env.current.roundMap,
|
||||
roundSocketHub = lila.hub.Env.current.socket.round,
|
||||
lightUserApi = lila.user.Env.current.lightUserApi,
|
||||
isOnline = lila.user.Env.current.isOnline,
|
||||
onStart = lila.game.Env.current.onStart,
|
||||
|
|
|
@ -2,6 +2,7 @@ package lila.tv
|
|||
|
||||
import akka.actor._
|
||||
import com.typesafe.config.Config
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import lila.db.dsl._
|
||||
import lila.game.Game
|
||||
|
@ -11,7 +12,7 @@ import scala.concurrent.duration._
|
|||
final class Env(
|
||||
config: Config,
|
||||
db: lila.db.Env,
|
||||
hub: lila.hub.Env,
|
||||
renderer: ActorSelection,
|
||||
lightUser: lila.common.LightUser.GetterSync,
|
||||
roundProxyGame: Game.ID => Fu[Option[Game]],
|
||||
system: ActorSystem,
|
||||
|
@ -25,18 +26,12 @@ final class Env(
|
|||
private val selectChannel = system.actorOf(Props(classOf[lila.socket.Channel]), name = ChannelSelect)
|
||||
|
||||
private val tvActor = system.actorOf(
|
||||
Props(new TvActor(hub.actor.renderer, hub.socket.round, selectChannel, lightUser, onSelect))
|
||||
Props(new TvActor(renderer, selectChannel, lightUser, onSelect))
|
||||
)
|
||||
|
||||
lazy val tv = new Tv(tvActor, roundProxyGame)
|
||||
|
||||
{
|
||||
import scala.concurrent.duration._
|
||||
|
||||
scheduler.message(FeaturedSelect) {
|
||||
tvActor -> TvActor.Select
|
||||
}
|
||||
}
|
||||
scheduler.message(FeaturedSelect) { tvActor -> TvActor.Select }
|
||||
}
|
||||
|
||||
object Env {
|
||||
|
@ -44,7 +39,7 @@ object Env {
|
|||
lazy val current = "tv" boot new Env(
|
||||
config = lila.common.PlayApp loadConfig "tv",
|
||||
db = lila.db.Env.current,
|
||||
hub = lila.hub.Env.current,
|
||||
renderer = lila.hub.Env.current.actor.renderer,
|
||||
lightUser = lila.user.Env.current.lightUserSync,
|
||||
roundProxyGame = lila.round.Env.current.roundProxyGame _,
|
||||
system = lila.common.PlayApp.system,
|
||||
|
|
|
@ -10,7 +10,6 @@ import lila.game.{ Game, GameRepo }
|
|||
|
||||
private[tv] final class TvActor(
|
||||
rendererActor: ActorSelection,
|
||||
roundSocket: ActorSelection,
|
||||
selectChannel: ActorRef,
|
||||
lightUser: LightUser.GetterSync,
|
||||
onSelect: Game => Unit
|
||||
|
|
Loading…
Reference in New Issue