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

block when exhausted, new config options for the compatibility pool max connections

This commit is contained in:
mohammed jasem alaajel 2022-07-26 17:51:41 +04:00
parent ee76fa0b3d
commit d77e909e7d
2 changed files with 6 additions and 1 deletions

View File

@ -78,6 +78,7 @@ public interface ConfigLoader {
Set<HostAndPort> hostAndPortSet = new HashSet<>();
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
poolConfig.setMaxTotal(maxConnections);
poolConfig.setBlockWhenExhausted(true);
node.getNode("redis-cluster-servers").getChildrenList().forEach((childNode) -> {
Map<Object, ? extends ConfigurationNode> hostAndPort = childNode.getChildrenMap();
String host = hostAndPort.get("host").getString();
@ -105,11 +106,13 @@ public interface ConfigLoader {
JedisPool jedisPool = null;
if (node.getNode("enable-jedis-pool-compatibility").getBoolean(true)) {
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(maxConnections);
config.setMaxTotal(node.getNode("compatibility-max-connections").getInt(3));
config.setBlockWhenExhausted(true);
jedisPool = new JedisPool(config, redisServer, redisPort, 0, redisPassword, useSSL);
}
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
poolConfig.setMaxTotal(maxConnections);
poolConfig.setBlockWhenExhausted(true);
summoner = new JedisPooledSummoner(new JedisPooled(poolConfig, redisServer, redisPort, 0, redisPassword, useSSL), jedisPool);
redisBungeeMode = RedisBungeeMode.SINGLE;
}

View File

@ -46,6 +46,8 @@ proxy-id: "test-1"
# enabled by default
# ignored when cluster mode is enabled
enable-jedis-pool-compatibility: true
# max connections for the compatibility pool
compatibility-max-connections: 3
# Register redis bungee legacy commands
# if this disabled override-bungee-commands will be ignored