mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
Attempt to fix PubSub disconnection issues.
This commit is contained in:
parent
84029fa856
commit
565de9b4c0
@ -96,7 +96,7 @@ public final class RedisBungee extends Plugin {
|
||||
if (lagged ? time >= stamp + 30 : time <= stamp + 30)
|
||||
servers.add(entry.getKey());
|
||||
else if (nag && nagTime <= 0) {
|
||||
getLogger().severe(entry.getKey() + " is " + (System.currentTimeMillis() - stamp) + "ms behind! (Time not synchronized or server down?)");
|
||||
getLogger().severe(entry.getKey() + " is " + (time - stamp) + " seconds behind! (Time not synchronized or server down?)");
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
@ -505,10 +505,22 @@ public final class RedisBungee extends Plugin {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean broken = false;
|
||||
try (Jedis rsc = pool.getResource()) {
|
||||
jpsh = new JedisPubSubHandler();
|
||||
rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data");
|
||||
} catch (JedisException | ClassCastException ignored) {
|
||||
try {
|
||||
jpsh = new JedisPubSubHandler();
|
||||
rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data");
|
||||
} catch (Exception e) {
|
||||
// FIXME: Extremely ugly hack
|
||||
// Attempt to unsubscribe this instance and try again.
|
||||
getLogger().log(Level.INFO, "PubSub error, attempting to recover.", e);
|
||||
jpsh.unsubscribe();
|
||||
broken = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (broken) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user