diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index bf9fd8af8..e5a144cbf 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -149,6 +149,7 @@ data: database: minecraft username: root password: '' + pool-size: 10 # The size of the MySQL connection pool. # Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing. # e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources. diff --git a/bungee/src/main/resources/config.yml b/bungee/src/main/resources/config.yml index 0ccba752d..0a71488fe 100644 --- a/bungee/src/main/resources/config.yml +++ b/bungee/src/main/resources/config.yml @@ -107,6 +107,7 @@ data: database: minecraft username: root password: '' + pool-size: 10 # The size of the MySQL connection pool. # Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing. # e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources. diff --git a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java index 87787fa7c..e37434b7f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/AbstractConfiguration.java @@ -130,7 +130,8 @@ public abstract class AbstractConfiguration implement getString("data.address", null), getString("data.database", null), getString("data.username", null), - getString("data.password", null) + getString("data.password", null), + getInt("data.pool-size", 10) ); storageMethod = getString("storage-method", defaultStorage); splitStorage = getBoolean("split-storage.enabled", false); diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/DatastoreConfiguration.java b/common/src/main/java/me/lucko/luckperms/common/storage/DatastoreConfiguration.java index fa1be0484..a891b2ce2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/DatastoreConfiguration.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/DatastoreConfiguration.java @@ -33,5 +33,6 @@ public class DatastoreConfiguration implements me.lucko.luckperms.api.data.Datas private final String database; private final String username; private final String password; + private int poolSize; } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MySQLBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MySQLBacking.java index 52157c936..03707b2f8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MySQLBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MySQLBacking.java @@ -56,8 +56,9 @@ public class MySQLBacking extends SQLBacking { final String database = configuration.getDatabase(); final String username = configuration.getUsername(); final String password = configuration.getPassword(); + + config.setMaximumPoolSize(configuration.getPoolSize()); - config.setMaximumPoolSize(10); config.setPoolName("luckperms"); config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.addDataSourceProperty("serverName", address.split(":")[0]); diff --git a/sponge/src/main/resources/luckperms.conf b/sponge/src/main/resources/luckperms.conf index 51387731a..4cb0eb964 100644 --- a/sponge/src/main/resources/luckperms.conf +++ b/sponge/src/main/resources/luckperms.conf @@ -107,6 +107,7 @@ data { database="minecraft" username="root" password="" + pool-size=10 # The size of the MySQL connection pool. # Set to -1 to disable. If this is the only instance accessing the datastore, you can disable syncing. # e.g. if you're using sqlite or flatfile, this can be set to -1 to save resources.