Admin controller draft

This commit is contained in:
Viktor Kholodov
2021-01-09 02:09:00 +03:00
parent 23f566af51
commit e702bd61b4
13 changed files with 119 additions and 37 deletions
+4 -3
View File
@@ -28,11 +28,12 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
// Use a direct reference to SLF4J
private val logger = org.slf4j.LoggerFactory.getLogger("controllers.HomeController")
val lobbiesActror: ActorRef = actorSystem.actorOf(Props[LobbiesActor]())
val userParentActor: ActorRef = actorSystem.actorOf(Props(classOf[UserParentActor], actorSystem))
// Home page that renders template
def index() = Action { implicit request =>
logger.info(s"Received request from: ${request.remoteAddress}")
Ok(views.html.index())
}
@@ -161,7 +162,7 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
val flowWatch: Flow[JsValue, JsValue, NotUsed] = flow.watchTermination() { (_, termination) =>
termination.foreach { done =>
logger.info(s"Terminating actor $userActor")
lobbiesActror.tell(UnWatchAllLobbies, userActor)
LobbiesActor.actor.tell(UnWatchAllLobbies, userActor)
actorSystem.stop(userActor)
}
NotUsed
@@ -181,7 +182,7 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
// Use guice assisted injection to instantiate and configure the child actor.
val userActorFuture = {
implicit val timeout = Timeout(100.millis)
(userParentActor ? UserParentActor.Create(name, webSocketOut, lobbiesActror)).mapTo[ActorRef]
(userParentActor ? UserParentActor.Create(name, webSocketOut)).mapTo[ActorRef]
}
userActorFuture
}