feat: Add logging to Gateway for pod synchronization and startup events

This commit is contained in:
2026-01-07 14:54:26 +01:00
parent bbbbf33c41
commit 6ef7401443
3 changed files with 9 additions and 2 deletions

View File

@@ -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())