Merge "Change default value of database.poolMaxIdle"
This commit is contained in:
@@ -1423,7 +1423,7 @@ This setting only applies if
|
|||||||
Maximum number of connections to keep idle in the pool. If there
|
Maximum number of connections to keep idle in the pool. If there
|
||||||
are more idle connections, connections will be closed instead of
|
are more idle connections, connections will be closed instead of
|
||||||
being returned back to the pool.
|
being returned back to the pool.
|
||||||
Default is 4.
|
Default is min(<<database.poolLimit, database.poolLimit>>, 16).
|
||||||
+
|
+
|
||||||
This setting only applies if
|
This setting only applies if
|
||||||
<<database.connectionPool,database.connectionPool>> is true.
|
<<database.connectionPool,database.connectionPool>> is true.
|
||||||
|
|||||||
@@ -129,9 +129,11 @@ public class DataSourceProvider implements Provider<DataSource>,
|
|||||||
if (password != null && !password.isEmpty()) {
|
if (password != null && !password.isEmpty()) {
|
||||||
ds.setPassword(password);
|
ds.setPassword(password);
|
||||||
}
|
}
|
||||||
ds.setMaxActive(threadSettingsConfig.getDatabasePoolLimit());
|
int poolLimit = threadSettingsConfig.getDatabasePoolLimit();
|
||||||
|
ds.setMaxActive(poolLimit);
|
||||||
ds.setMinIdle(cfg.getInt("database", "poolminidle", 4));
|
ds.setMinIdle(cfg.getInt("database", "poolminidle", 4));
|
||||||
ds.setMaxIdle(cfg.getInt("database", "poolmaxidle", 4));
|
ds.setMaxIdle(
|
||||||
|
cfg.getInt("database", "poolmaxidle", Math.min(poolLimit, 16)));
|
||||||
ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null,
|
ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null,
|
||||||
"poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS));
|
"poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS));
|
||||||
ds.setInitialSize(ds.getMinIdle());
|
ds.setInitialSize(ds.getMinIdle());
|
||||||
|
|||||||
Reference in New Issue
Block a user