From 6ef74014430673e725245bf37e44c5b90b81abb3 Mon Sep 17 00:00:00 2001 From: Janis Date: Wed, 7 Jan 2026 14:54:26 +0100 Subject: [PATCH] feat: Add logging to Gateway for pod synchronization and startup events --- knockoutwhistfrontend | 2 +- knockoutwhistweb/app/logic/Gateway.scala | 6 ++++++ knockoutwhistweb/app/modules/GatewayModule.scala | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/knockoutwhistfrontend b/knockoutwhistfrontend index d8b3904..352b7fd 160000 --- a/knockoutwhistfrontend +++ b/knockoutwhistfrontend @@ -1 +1 @@ -Subproject commit d8b3904cbc8b08ed9522d7b9b4fa8af79bc75def +Subproject commit 352b7fd3ff689dea1693ae1059634a6768107211 diff --git a/knockoutwhistweb/app/logic/Gateway.scala b/knockoutwhistweb/app/logic/Gateway.scala index ddb9d8d..4d1a005 100644 --- a/knockoutwhistweb/app/logic/Gateway.scala +++ b/knockoutwhistweb/app/logic/Gateway.scala @@ -4,6 +4,7 @@ import de.knockoutwhist.data.Pod import de.knockoutwhist.data.redis.RedisManager import org.apache.pekko.actor.ActorSystem import org.redisson.config.Config +import play.api.Logger import play.api.inject.ApplicationLifecycle import java.util.UUID @@ -17,6 +18,8 @@ class Gateway @Inject()( actorSystem: ActorSystem )(implicit ec: ExecutionContext) { + private val logger = Logger(getClass.getName) + val redis: RedisManager = { val config: Config = Config() config.useSingleServer.setAddress("valkey://" + sys.env.getOrElse("VALKEY_HOST", "localhost") + ":" + sys.env.getOrElse("VALKEY_PORT", "6379")) @@ -24,8 +27,11 @@ class Gateway @Inject()( } redis.continuousSyncPod(() => { + logger.info("Syncing pod with Redis") createPod() }) + + logger.info("Gateway started") def syncPod(): Unit = { redis.syncPod(createPod()) diff --git a/knockoutwhistweb/app/modules/GatewayModule.scala b/knockoutwhistweb/app/modules/GatewayModule.scala index f31b384..ab7894f 100644 --- a/knockoutwhistweb/app/modules/GatewayModule.scala +++ b/knockoutwhistweb/app/modules/GatewayModule.scala @@ -1,9 +1,10 @@ package modules import com.google.inject.AbstractModule +import logic.Gateway class GatewayModule extends AbstractModule { override def configure(): Unit = { - bind(classOf[GatewayModule]).asEagerSingleton() + bind(classOf[Gateway]).asEagerSingleton() } }