From f1a0d23c99265df542f09fe2bed662790e6e352f Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 15 May 2022 14:18:00 -0400 Subject: [PATCH] Log ping result if it's not PONG --- ProjectLighthouse/Redis.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Redis.cs b/ProjectLighthouse/Redis.cs index 966a7345..7aa6ab7c 100644 --- a/ProjectLighthouse/Redis.cs +++ b/ProjectLighthouse/Redis.cs @@ -1,5 +1,7 @@ #nullable enable using System; +using System.Diagnostics; +using System.Globalization; using System.Linq; using System.Threading.Tasks; using LBPUnion.ProjectLighthouse.Helpers; @@ -29,6 +31,13 @@ public static class Redis IRedisConnection connection = getConnection(); + string pong = (await connection.ExecuteAsync("PING")).ToString(CultureInfo.InvariantCulture); + if (pong != "PONG") + { + Logger.LogError("Could not ping, ping returned " + pong, LogArea.Redis); + return; + } + await connection.CreateIndexAsync(typeof(Room)); await connection.CreateIndexAsync(typeof(UserFriendStore)); @@ -38,7 +47,7 @@ public static class Redis private static IRedisConnection getConnection() { - Logger.LogDebug("Getting a redis connection", LogArea.Redis); + Logger.LogDebug("Getting a Redis connection", LogArea.Redis); return provider.Connection; }