2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 18:48:02 +00:00

Force Redis >= 2.6

This commit is contained in:
Tux 2015-11-09 14:31:36 -05:00
parent d691180011
commit 3102034e6b

View File

@ -254,17 +254,15 @@ public final class RedisBungee extends Plugin {
}
if (pool != null) {
try (Jedis tmpRsc = pool.getResource()) {
tmpRsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.currentTimeMillis()));
// This is more portable than INFO <section>
String info = tmpRsc.info();
for (String s : info.split("\r\n")) {
if (s.startsWith("redis_version:")) {
String version = s.split(":")[1];
if (!(usingLua = RedisUtil.canUseLua(version))) {
getLogger().warning("Your version of Redis (" + version + ") is below 2.6. RedisBungee will disable optimizations using Lua.");
getLogger().warning("Support for versions of Redis below version 2.6 will be removed in the future.");
getLogger().warning("Your version of Redis (" + version + ") is not at least version 2.6. RedisBungee requires a newer version.");
throw new RuntimeException("Unsupported Redis version detected");
} else {
getLogger().info("Using Redis >= 2.6, enabling Lua optimizations.");
LuaManager manager = new LuaManager(this);
serverToPlayersScript = manager.createScript(IOUtil.readInputStreamAsString(getResourceAsStream("lua/server_to_players.lua")));
}
@ -272,6 +270,8 @@ public final class RedisBungee extends Plugin {
}
}
tmpRsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.currentTimeMillis()));
long uuidCacheSize = tmpRsc.hlen("uuid-cache");
if (uuidCacheSize > 750000) {
getLogger().info("Looks like you have a really big UUID cache! Run https://www.spigotmc.org/resources/redisbungeecleaner.8505/ as soon as possible.");