Disable the automatic poolSize option

it creates more issues than benefits
This commit is contained in:
Gabriele C
2017-12-13 23:13:28 +01:00
parent 2d77f54695
commit 26a69297ce
6 changed files with 22 additions and 25 deletions
@@ -70,6 +70,7 @@ public class SettingsMigrationService extends PlainMigrationService {
| performMailTextToFileMigration(resource)
| migrateJoinLeaveMessages(resource)
| migrateForceSpawnSettings(resource)
| migratePoolSizeSetting(resource)
| changeBooleanSettingToLogLevelProperty(resource)
| hasOldHelpHeaderProperty(resource)
| hasSupportOldPasswordProperty(resource)
@@ -194,6 +195,21 @@ public class SettingsMigrationService extends PlainMigrationService {
| moveProperty(oldForceWorlds, FORCE_SPAWN_ON_WORLDS, resource);
}
/**
* Detects the old auto poolSize value and replaces it with the default value.
*
* @param resource The property resource
* @return True if the configuration has changed, false otherwise
*/
private static boolean migratePoolSizeSetting(PropertyResource resource) {
Integer oldValue = resource.getInt("DataSource.poolSize");
if(oldValue == null || oldValue > 0) {
return false;
}
resource.setValue("DataSource.poolSize", 10);
return true;
}
/**
* Changes the old boolean property "hide spam from console" to the new property specifying
* the log level.
@@ -123,9 +123,9 @@ public final class DatabaseSettings implements SettingsHolder {
public static final Property<String> MYSQL_COL_GROUP =
newProperty("ExternalBoardOptions.mySQLColumnGroup", "");
@Comment("Overrides the size of the DB Connection Pool, -1 = Auto")
@Comment("Overrides the size of the DB Connection Pool, default = 10")
public static final Property<Integer> MYSQL_POOL_SIZE =
newProperty("DataSource.poolSize", -1);
newProperty("DataSource.poolSize", 10);
@Comment({"The maximum lifetime of a connection in the pool, default = 1800 seconds",
"You should set this at least 30 seconds less than mysql server wait_timeout"})