Try making the integrity checks a bit more careful

This commit is contained in:
Tux 2016-03-05 21:39:01 -05:00
parent 4980ec6a0d
commit 3fa9b31ad5
1 changed files with 21 additions and 25 deletions

View File

@ -320,37 +320,33 @@ public final class RedisBungee extends Plugin {
} }
} }
for (Iterator<String> it = playersInRedis.iterator(); it.hasNext(); ) { Set<String> absentLocally = new HashSet<>(playersInRedis);
String member = it.next(); absentLocally.removeAll(players);
if (!players.contains(member)) { Set<String> absentInRedis = new HashSet<>(players);
// Are they simply on a different proxy? absentInRedis.removeAll(playersInRedis);
String found = null;
for (String proxyId : getServerIds()) {
if (proxyId.equals(configuration.getServerId())) continue;
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", member)) {
// Just clean up the set.
found = proxyId;
break;
}
}
if (found == null) {
RedisUtil.cleanUpPlayer(member, tmpRsc);
getLogger().warning("Player found in set that was not found locally and globally: " + member);
} else {
tmpRsc.srem("proxy:" + configuration.getServerId() + ":usersOnline", member);
getLogger().warning("Player found in set that was not found locally, but is on another proxy: " + member);
}
it.remove(); for (String member : absentLocally) {
boolean found = false;
for (String proxyId : getServerIds()) {
if (proxyId.equals(configuration.getServerId())) continue;
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", member)) {
// Just clean up the set.
found = true;
break;
}
}
if (!found) {
RedisUtil.cleanUpPlayer(member, tmpRsc);
getLogger().warning("Player found in set that was not found locally and globally: " + member);
} else {
tmpRsc.srem("proxy:" + configuration.getServerId() + ":usersOnline", member);
getLogger().warning("Player found in set that was not found locally, but is on another proxy: " + member);
} }
} }
Pipeline pipeline = tmpRsc.pipelined(); Pipeline pipeline = tmpRsc.pipelined();
for (String player : players) { for (String player : absentLocally) {
if (playersInRedis.contains(player))
continue;
// Player not online according to Redis but not BungeeCord. // Player not online according to Redis but not BungeeCord.
getLogger().warning("Player " + player + " is on the proxy but not in Redis."); getLogger().warning("Player " + player + " is on the proxy but not in Redis.");