9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-23 16:49:19 +00:00

refactor: use guard clause in thread unlock logic

This commit is contained in:
William278
2024-01-24 23:00:41 +00:00
parent 31920d056d
commit 280e90e297

View File

@@ -117,11 +117,14 @@ public class RedisManager extends JedisPubSub {
} }
} }
private void onThreadUnlock(Throwable t) { private void onThreadUnlock(@NotNull Throwable t) {
if (enabled) { if (!enabled) {
return;
}
if (reconnected) { if (reconnected) {
plugin.log(Level.WARNING, plugin.log(Level.WARNING, "Redis Server connection lost. Attempting reconnect in %ss..."
"Connection to the Redis server was lost. Attempting reconnection in 8 seconds...", t); .formatted(RECONNECTION_TIME / 1000), t);
} }
try { try {
this.unsubscribe(); this.unsubscribe();
@@ -140,7 +143,6 @@ public class RedisManager extends JedisPubSub {
} }
} }
} }
}
@Override @Override
public void onMessage(@NotNull String channel, @NotNull String message) { public void onMessage(@NotNull String channel, @NotNull String message) {