mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-25 17:49:20 +00:00
Tweak debug logging when reading Redis keys
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user