mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-01 18:32:33 +02:00
Add config option to set Hikari keepalive property
This commit is contained in:
@@ -128,6 +128,12 @@ data:
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime: 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout: 5000 # 5 seconds
|
connection-timeout: 5000 # 5 seconds
|
||||||
|
@@ -125,6 +125,12 @@ data:
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime: 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout: 5000 # 5 seconds
|
connection-timeout: 5000 # 5 seconds
|
||||||
|
@@ -51,7 +51,7 @@ dependencies {
|
|||||||
compile('me.lucko.configurate:configurate-toml:3.7') {
|
compile('me.lucko.configurate:configurate-toml:3.7') {
|
||||||
exclude(module: 'toml4j')
|
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 'redis.clients:jedis:3.3.0'
|
||||||
compile 'com.rabbitmq:amqp-client:5.10.0'
|
compile 'com.rabbitmq:amqp-client:5.10.0'
|
||||||
compile 'org.mongodb:mongo-java-driver:3.12.2'
|
compile 'org.mongodb:mongo-java-driver:3.12.2'
|
||||||
|
@@ -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 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 minIdle = c.getInteger("data.pool-settings.minimum-idle", maxPoolSize);
|
||||||
int maxLifetime = c.getInteger("data.pool-settings.maximum-lifetime", 1800000);
|
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);
|
int connectionTimeout = c.getInteger("data.pool-settings.connection-timeout", 5000);
|
||||||
Map<String, String> props = ImmutableMap.copyOf(c.getStringMap("data.pool-settings.properties", ImmutableMap.of()));
|
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.database", null),
|
||||||
c.getString("data.username", null),
|
c.getString("data.username", null),
|
||||||
c.getString("data.password", null),
|
c.getString("data.password", null),
|
||||||
maxPoolSize, minIdle, maxLifetime, connectionTimeout, props
|
maxPoolSize, minIdle, maxLifetime, keepAliveTime, connectionTimeout, props
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -146,6 +146,7 @@ public abstract class HikariConnectionFactory implements ConnectionFactory {
|
|||||||
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
|
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
|
||||||
config.setMinimumIdle(this.configuration.getMinIdleConnections());
|
config.setMinimumIdle(this.configuration.getMinIdleConnections());
|
||||||
config.setMaxLifetime(this.configuration.getMaxLifetime());
|
config.setMaxLifetime(this.configuration.getMaxLifetime());
|
||||||
|
config.setKeepaliveTime(this.configuration.getKeepAliveTime());
|
||||||
config.setConnectionTimeout(this.configuration.getConnectionTimeout());
|
config.setConnectionTimeout(this.configuration.getConnectionTimeout());
|
||||||
|
|
||||||
// don't perform any initial connection validation - we subsequently call #getConnection
|
// don't perform any initial connection validation - we subsequently call #getConnection
|
||||||
|
@@ -37,10 +37,11 @@ public class StorageCredentials {
|
|||||||
private final int maxPoolSize;
|
private final int maxPoolSize;
|
||||||
private final int minIdleConnections;
|
private final int minIdleConnections;
|
||||||
private final int maxLifetime;
|
private final int maxLifetime;
|
||||||
|
private final int keepAliveTime;
|
||||||
private final int connectionTimeout;
|
private final int connectionTimeout;
|
||||||
private final Map<String, String> properties;
|
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.address = address;
|
||||||
this.database = database;
|
this.database = database;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
@@ -48,6 +49,7 @@ public class StorageCredentials {
|
|||||||
this.maxPoolSize = maxPoolSize;
|
this.maxPoolSize = maxPoolSize;
|
||||||
this.minIdleConnections = minIdleConnections;
|
this.minIdleConnections = minIdleConnections;
|
||||||
this.maxLifetime = maxLifetime;
|
this.maxLifetime = maxLifetime;
|
||||||
|
this.keepAliveTime = keepAliveTime;
|
||||||
this.connectionTimeout = connectionTimeout;
|
this.connectionTimeout = connectionTimeout;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
@@ -80,6 +82,10 @@ public class StorageCredentials {
|
|||||||
return this.maxLifetime;
|
return this.maxLifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getKeepAliveTime() {
|
||||||
|
return this.keepAliveTime;
|
||||||
|
}
|
||||||
|
|
||||||
public int getConnectionTimeout() {
|
public int getConnectionTimeout() {
|
||||||
return this.connectionTimeout;
|
return this.connectionTimeout;
|
||||||
}
|
}
|
||||||
|
@@ -128,6 +128,12 @@ data {
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime = 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout = 5000 # 5 seconds
|
connection-timeout = 5000 # 5 seconds
|
||||||
|
@@ -128,6 +128,12 @@ data:
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime: 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout: 5000 # 5 seconds
|
connection-timeout: 5000 # 5 seconds
|
||||||
|
@@ -128,6 +128,12 @@ data {
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime = 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout = 5000 # 5 seconds
|
connection-timeout = 5000 # 5 seconds
|
||||||
|
@@ -118,6 +118,12 @@ data:
|
|||||||
# connection time limit.
|
# connection time limit.
|
||||||
maximum-lifetime: 1800000 # 30 minutes
|
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
|
# This setting controls the maximum number of milliseconds that the plugin will wait for a
|
||||||
# connection from the pool, before timing out.
|
# connection from the pool, before timing out.
|
||||||
connection-timeout: 5000 # 5 seconds
|
connection-timeout: 5000 # 5 seconds
|
||||||
|
Reference in New Issue
Block a user