mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-12-23 10:38:01 +00:00
older versions or redis than (6.2) is no longer supported
This commit is contained in:
parent
f53829481a
commit
51115746c7
@ -246,8 +246,9 @@ public final class RedisBungee extends Plugin {
|
||||
for (String s : info.split("\r\n")) {
|
||||
if (s.startsWith("redis_version:")) {
|
||||
String version = s.split(":")[1];
|
||||
getLogger().info(version + " <- redis version");
|
||||
if (!(usingLua = RedisUtil.canUseLua(version))) {
|
||||
getLogger().warning("Your version of Redis (" + version + ") is not at least version 2.6. RedisBungee requires a newer version of Redis.");
|
||||
getLogger().warning("Your version of Redis (" + version + ") is not at least version 6.2 RedisBungee requires a newer version of Redis.");
|
||||
throw new RuntimeException("Unsupported Redis version detected");
|
||||
} else {
|
||||
LuaManager manager = new LuaManager(this);
|
||||
|
@ -58,16 +58,13 @@ public class RedisUtil {
|
||||
}
|
||||
|
||||
public static boolean canUseLua(String redisVersion) {
|
||||
// Need to use >=2.6 to use Lua optimizations.
|
||||
// Need to use >=6.2 to use Lua optimizations.
|
||||
String[] args = redisVersion.split("\\.");
|
||||
|
||||
if (args.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int major = Integer.parseInt(args[0]);
|
||||
int minor = Integer.parseInt(args[1]);
|
||||
|
||||
return major >= 3 || (major == 2 && minor >= 6);
|
||||
return major >= 6 && minor >= 2;
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,14 @@ import org.junit.Test;
|
||||
public class RedisUtilTest {
|
||||
@Test
|
||||
public void testRedisLuaCheck() {
|
||||
Assert.assertTrue(RedisUtil.canUseLua("2.6.0"));
|
||||
Assert.assertTrue(RedisUtil.canUseLua("6.2.0"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("6.1.0"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("6.0.0"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("2.6.0"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("2.2.12"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("1.2.4"));
|
||||
Assert.assertTrue(RedisUtil.canUseLua("2.8.4"));
|
||||
Assert.assertTrue(RedisUtil.canUseLua("3.0.0"));
|
||||
Assert.assertTrue(RedisUtil.canUseLua("3.2.1"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("2.8.4"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("3.0.0"));
|
||||
Assert.assertFalse(RedisUtil.canUseLua("3.2.1"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user