diff --git a/common/src/main/java/net/william278/husksync/listener/EventListener.java b/common/src/main/java/net/william278/husksync/listener/EventListener.java index 019002f7..3d55888b 100644 --- a/common/src/main/java/net/william278/husksync/listener/EventListener.java +++ b/common/src/main/java/net/william278/husksync/listener/EventListener.java @@ -79,8 +79,8 @@ public abstract class EventListener { } if (disabling || currentMilliseconds.get() > TIME_OUT_MILLISECONDS) { executor.shutdown(); - setUserFromDatabase(user) - .thenAccept(succeeded -> handleSynchronisationCompletion(user, succeeded)); + setUserFromDatabase(user).thenAccept( + succeeded -> handleSynchronisationCompletion(user, succeeded)); return; } plugin.getRedisManager().getUserData(user).thenAccept(redisUserData -> diff --git a/common/src/main/java/net/william278/husksync/redis/RedisManager.java b/common/src/main/java/net/william278/husksync/redis/RedisManager.java index 51ce6ab4..949e41a1 100644 --- a/common/src/main/java/net/william278/husksync/redis/RedisManager.java +++ b/common/src/main/java/net/william278/husksync/redis/RedisManager.java @@ -165,13 +165,17 @@ public class RedisManager { return CompletableFuture.supplyAsync(() -> { try (Jedis jedis = jedisPool.getResource()) { final byte[] key = getKey(RedisKeyType.DATA_UPDATE, user.uuid); - plugin.getLoggingAdapter().debug("[" + user.username + "] Read " + RedisKeyType.DATA_UPDATE.name() - + " key from redis at: " + - new SimpleDateFormat("mm:ss.SSS").format(new Date())); final byte[] dataByteArray = jedis.get(key); if (dataByteArray == null) { + plugin.getLoggingAdapter().debug("[" + user.username + "] Could not read " + + RedisKeyType.DATA_UPDATE.name() + " key from redis at: " + + new SimpleDateFormat("mm:ss.SSS").format(new Date())); return Optional.empty(); } + plugin.getLoggingAdapter().debug("[" + user.username + "] Successfully read " + + RedisKeyType.DATA_UPDATE.name() + " key from redis at: " + + new SimpleDateFormat("mm:ss.SSS").format(new Date())); + // Consume the key (delete from redis) jedis.del(key); @@ -188,13 +192,17 @@ public class RedisManager { return CompletableFuture.supplyAsync(() -> { try (Jedis jedis = jedisPool.getResource()) { final byte[] key = getKey(RedisKeyType.SERVER_SWITCH, user.uuid); - plugin.getLoggingAdapter().debug("[" + user.username + "] Read " + RedisKeyType.SERVER_SWITCH.name() - + " key from redis at: " + - new SimpleDateFormat("mm:ss.SSS").format(new Date())); final byte[] readData = jedis.get(key); if (readData == null) { + plugin.getLoggingAdapter().debug("[" + user.username + "] Could not read " + + RedisKeyType.SERVER_SWITCH.name() + " key from redis at: " + + new SimpleDateFormat("mm:ss.SSS").format(new Date())); return false; } + plugin.getLoggingAdapter().debug("[" + user.username + "] Successfully read " + + RedisKeyType.SERVER_SWITCH.name() + " key from redis at: " + + new SimpleDateFormat("mm:ss.SSS").format(new Date())); + // Consume the key (delete from redis) jedis.del(key); return true;