1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-08-31 01:59:48 +02:00

Add config option to set Hikari keepalive property

This commit is contained in:
Luck
2021-02-22 23:02:43 +00:00
parent 734b011dc7
commit 4ff2c75538
10 changed files with 47 additions and 3 deletions

View File

@@ -128,6 +128,12 @@ data:
# connection time limit.
maximum-lifetime: 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time: 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout: 5000 # 5 seconds

View File

@@ -125,6 +125,12 @@ data:
# connection time limit.
maximum-lifetime: 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time: 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout: 5000 # 5 seconds

View File

@@ -51,7 +51,7 @@ dependencies {
compile('me.lucko.configurate:configurate-toml:3.7') {
exclude(module: 'toml4j')
}
compile 'com.zaxxer:HikariCP:3.4.5'
compile 'com.zaxxer:HikariCP:4.0.2'
compile 'redis.clients:jedis:3.3.0'
compile 'com.rabbitmq:amqp-client:5.10.0'
compile 'org.mongodb:mongo-java-driver:3.12.2'

View File

@@ -516,6 +516,7 @@ public final class ConfigKeys {
int maxPoolSize = c.getInteger("data.pool-settings.maximum-pool-size", c.getInteger("data.pool-size", 10));
int minIdle = c.getInteger("data.pool-settings.minimum-idle", maxPoolSize);
int maxLifetime = c.getInteger("data.pool-settings.maximum-lifetime", 1800000);
int keepAliveTime = c.getInteger("data.pool-settings.keepalive-time", 0);
int connectionTimeout = c.getInteger("data.pool-settings.connection-timeout", 5000);
Map<String, String> props = ImmutableMap.copyOf(c.getStringMap("data.pool-settings.properties", ImmutableMap.of()));
@@ -524,7 +525,7 @@ public final class ConfigKeys {
c.getString("data.database", null),
c.getString("data.username", null),
c.getString("data.password", null),
maxPoolSize, minIdle, maxLifetime, connectionTimeout, props
maxPoolSize, minIdle, maxLifetime, keepAliveTime, connectionTimeout, props
);
}));

View File

@@ -146,6 +146,7 @@ public abstract class HikariConnectionFactory implements ConnectionFactory {
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
config.setMinimumIdle(this.configuration.getMinIdleConnections());
config.setMaxLifetime(this.configuration.getMaxLifetime());
config.setKeepaliveTime(this.configuration.getKeepAliveTime());
config.setConnectionTimeout(this.configuration.getConnectionTimeout());
// don't perform any initial connection validation - we subsequently call #getConnection

View File

@@ -37,10 +37,11 @@ public class StorageCredentials {
private final int maxPoolSize;
private final int minIdleConnections;
private final int maxLifetime;
private final int keepAliveTime;
private final int connectionTimeout;
private final Map<String, String> properties;
public StorageCredentials(String address, String database, String username, String password, int maxPoolSize, int minIdleConnections, int maxLifetime, int connectionTimeout, Map<String, String> properties) {
public StorageCredentials(String address, String database, String username, String password, int maxPoolSize, int minIdleConnections, int maxLifetime, int keepAliveTime, int connectionTimeout, Map<String, String> properties) {
this.address = address;
this.database = database;
this.username = username;
@@ -48,6 +49,7 @@ public class StorageCredentials {
this.maxPoolSize = maxPoolSize;
this.minIdleConnections = minIdleConnections;
this.maxLifetime = maxLifetime;
this.keepAliveTime = keepAliveTime;
this.connectionTimeout = connectionTimeout;
this.properties = properties;
}
@@ -80,6 +82,10 @@ public class StorageCredentials {
return this.maxLifetime;
}
public int getKeepAliveTime() {
return this.keepAliveTime;
}
public int getConnectionTimeout() {
return this.connectionTimeout;
}

View File

@@ -128,6 +128,12 @@ data {
# connection time limit.
maximum-lifetime = 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time = 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout = 5000 # 5 seconds

View File

@@ -128,6 +128,12 @@ data:
# connection time limit.
maximum-lifetime: 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time: 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout: 5000 # 5 seconds

View File

@@ -128,6 +128,12 @@ data {
# connection time limit.
maximum-lifetime = 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time = 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout = 5000 # 5 seconds

View File

@@ -118,6 +118,12 @@ data:
# connection time limit.
maximum-lifetime: 1800000 # 30 minutes
# This setting controls how frequently the pool will 'ping' a connection in order to prevent it
# from being timed out by the database or network infrastructure, measured in milliseconds.
# - The value should be less than maximum-lifetime and greater than 30000 (30 seconds).
# - Setting the value to zero will disable the keepalive functionality.
keepalive-time: 0
# This setting controls the maximum number of milliseconds that the plugin will wait for a
# connection from the pool, before timing out.
connection-timeout: 5000 # 5 seconds