refactor: use guard clause in thread unlock logic

feat/data-edit-commands
William278 10 months ago
parent 31920d056d
commit 280e90e297

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

Loading…
Cancel
Save