mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-02-26 01:11:26 +01:00
This commit is contained in:
parent
10fbc24f43
commit
665c53093a
@ -37,6 +37,7 @@ import java.sql.Statement;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public abstract class HikariConnectionFactory implements ConnectionFactory {
|
public abstract class HikariConnectionFactory implements ConnectionFactory {
|
||||||
|
|
||||||
@ -77,7 +78,13 @@ public abstract class HikariConnectionFactory implements ConnectionFactory {
|
|||||||
config.setPoolName("luckperms-hikari");
|
config.setPoolName("luckperms-hikari");
|
||||||
|
|
||||||
appendConfigurationInfo(config);
|
appendConfigurationInfo(config);
|
||||||
appendProperties(config, new HashMap<>(this.configuration.getProperties()));
|
|
||||||
|
Map<String, String> properties = new HashMap<>(this.configuration.getProperties());
|
||||||
|
|
||||||
|
// https://github.com/brettwooldridge/HikariCP/wiki/Rapid-Recovery
|
||||||
|
properties.putIfAbsent("socketTimeout", String.valueOf(TimeUnit.SECONDS.toMillis(30)));
|
||||||
|
|
||||||
|
appendProperties(config, properties);
|
||||||
|
|
||||||
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
|
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
|
||||||
config.setMinimumIdle(this.configuration.getMinIdleConnections());
|
config.setMinimumIdle(this.configuration.getMinIdleConnections());
|
||||||
|
@ -50,10 +50,6 @@ public class MariaDbConnectionFactory extends HikariConnectionFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void appendProperties(HikariConfig config, Map<String, String> properties) {
|
protected void appendProperties(HikariConfig config, Map<String, String> properties) {
|
||||||
if (properties.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String propertiesString = properties.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(";"));
|
String propertiesString = properties.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(";"));
|
||||||
|
|
||||||
// kinda hacky. this will call #setProperties on the datasource, which will append these options
|
// kinda hacky. this will call #setProperties on the datasource, which will append these options
|
||||||
|
@ -49,15 +49,18 @@ public class MySqlConnectionFactory extends HikariConnectionFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void appendProperties(HikariConfig config, Map<String, String> properties) {
|
protected void appendProperties(HikariConfig config, Map<String, String> properties) {
|
||||||
|
// https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
|
||||||
properties.putIfAbsent("cachePrepStmts", "true");
|
properties.putIfAbsent("cachePrepStmts", "true");
|
||||||
properties.putIfAbsent("alwaysSendSetIsolation", "false");
|
|
||||||
properties.putIfAbsent("cacheServerConfiguration", "true");
|
|
||||||
properties.putIfAbsent("elideSetAutoCommits", "true");
|
|
||||||
properties.putIfAbsent("useLocalSessionState", "true");
|
|
||||||
|
|
||||||
properties.putIfAbsent("useServerPrepStmts", "true");
|
|
||||||
properties.putIfAbsent("prepStmtCacheSize", "250");
|
properties.putIfAbsent("prepStmtCacheSize", "250");
|
||||||
properties.putIfAbsent("prepStmtCacheSqlLimit", "2048");
|
properties.putIfAbsent("prepStmtCacheSqlLimit", "2048");
|
||||||
|
properties.putIfAbsent("useServerPrepStmts", "true");
|
||||||
|
properties.putIfAbsent("useLocalSessionState", "true");
|
||||||
|
properties.putIfAbsent("rewriteBatchedStatements", "true");
|
||||||
|
properties.putIfAbsent("cacheResultSetMetadata", "true");
|
||||||
|
properties.putIfAbsent("cacheServerConfiguration", "true");
|
||||||
|
properties.putIfAbsent("elideSetAutoCommits", "true");
|
||||||
|
properties.putIfAbsent("maintainTimeStats", "false");
|
||||||
|
properties.putIfAbsent("alwaysSendSetIsolation", "false");
|
||||||
properties.putIfAbsent("cacheCallableStmts", "true");
|
properties.putIfAbsent("cacheCallableStmts", "true");
|
||||||
|
|
||||||
// append configurable properties
|
// append configurable properties
|
||||||
|
Loading…
Reference in New Issue
Block a user