Tweak debug logging when reading Redis keys

feat/data-edit-commands
William 3 years ago
parent 261b9cc00c
commit 082b3e6c42

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

@ -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;

Loading…
Cancel
Save