1.3.6-SNAPSHOT && updated deps && moved jedis to the parent && due removal of JedisBinary, Jedis has method of that class now so its easy drop replacement && fixed jedis wont connect if password is not empty? && adding default values if config somehow is empty or field not there
This commit is contained in:
parent
9ce27df3b8
commit
ac6fe6cb99
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<groupId>net.limework</groupId>
|
||||
<version>1.3.5</version>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -73,11 +73,6 @@
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.limework</groupId>
|
||||
<artifactId>RediSkript-core</artifactId>
|
||||
|
@ -47,18 +47,30 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
||||
int maxConnections = config.getInt("Redis.MaxConnections");
|
||||
|
||||
//do not allow less than 2 max connections as that causes issues
|
||||
if (maxConnections < 2) { maxConnections = 2; }
|
||||
if (maxConnections < 2) {
|
||||
maxConnections = 2;
|
||||
}
|
||||
|
||||
JConfig.setMaxTotal(maxConnections);
|
||||
JConfig.setMaxIdle(maxConnections);
|
||||
JConfig.setMinIdle(1);
|
||||
JConfig.setBlockWhenExhausted(true);
|
||||
final String password = config.getString("Redis.Password", "");
|
||||
if (password.isEmpty()) {
|
||||
this.jedisPool = new JedisPool(JConfig,
|
||||
config.getString("Redis.Host"),
|
||||
config.getInt("Redis.Port"),
|
||||
config.getInt("Redis.TimeOut"),
|
||||
config.getString("Redis.Password"),
|
||||
config.getBoolean("Redis.useTLS"));
|
||||
config.getString("Redis.Host", "127.0.0.1"),
|
||||
config.getInt("Redis.Port", 6379),
|
||||
config.getInt("Redis.TimeOut", 9000),
|
||||
config.getBoolean("Redis.useTLS", false));
|
||||
} else {
|
||||
this.jedisPool = new JedisPool(JConfig,
|
||||
config.getString("Redis.Host", "127.0.0.1"),
|
||||
config.getInt("Redis.Port", 6379),
|
||||
config.getInt("Redis.TimeOut", 9000),
|
||||
password,
|
||||
config.getBoolean("Redis.useTLS", false));
|
||||
}
|
||||
|
||||
encryption = new Encryption(config.getBoolean("Redis.EncryptMessages"),
|
||||
config.getString("Redis.EncryptionKey"),
|
||||
config.getString("Redis.MacKey"));
|
||||
@ -102,7 +114,7 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(byte[] channel, byte[] message){
|
||||
public void onMessage(byte[] channel, byte[] message) {
|
||||
String channelString = new String(channel, StandardCharsets.UTF_8);
|
||||
String receivedMessage = null;
|
||||
try {
|
||||
@ -293,7 +305,7 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
||||
//so to avoid issues, it's best to do it always on separate thread
|
||||
if (plugin.isEnabled()) {
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try (BinaryJedis j = jedisPool.getResource()) {
|
||||
try (Jedis j = jedisPool.getResource()) {
|
||||
j.publish(channel.getBytes(StandardCharsets.UTF_8), message);
|
||||
} catch (Exception e) {
|
||||
plugin.sendErrorLogs("Error sending redis message!");
|
||||
@ -303,7 +315,7 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
||||
} else {
|
||||
//execute sending of redis message on the main thread if plugin is disabling
|
||||
//so it can still process the sending
|
||||
try (BinaryJedis j = jedisPool.getResource()) {
|
||||
try (Jedis j = jedisPool.getResource()) {
|
||||
j.publish(channel.getBytes(StandardCharsets.UTF_8), message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -5,21 +5,10 @@
|
||||
<parent>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<groupId>net.limework</groupId>
|
||||
<version>1.3.5</version>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>RediSkript-core</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
11
pom.xml
11
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.limework</groupId>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<version>1.3.5</version>
|
||||
<version>1.3.6-SNAPSHOT</version>
|
||||
<modules>
|
||||
<module>RediSkript-core</module>
|
||||
<module>RediSkript-bukkit</module>
|
||||
@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20210307</version>
|
||||
<version>20220320</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
@ -54,7 +54,12 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<version>2.11.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>4.2.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user