Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cicd #189

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ postgresql_config_version: 0
# to be closed.
# postgresql_idle_connection_timeout:

# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 1) integer value. Minimum number of idle connections to be kept
# active.
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: null) integer value. Minimum number of idle connections to be kept
# active. If not set, minimum idle connections will be same as the connection pool size.
# postgresql_minimum_idle_connections:
4 changes: 2 additions & 2 deletions devConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ postgresql_password: "root"
# to be closed.
# postgresql_idle_connection_timeout:

# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 1) integer value. Minimum number of idle connections to be kept
# active.
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: null) integer value. Minimum number of idle connections to be kept
# active. If not set, minimum idle connections will be same as the connection pool size.
# postgresql_minimum_idle_connections:
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ private synchronized void initialiseHikariDataSource() throws SQLException {
config.setMaximumPoolSize(userConfig.getConnectionPoolSize());
config.setConnectionTimeout(5000);
config.setIdleTimeout(userConfig.getIdleConnectionTimeout());
rishabhpoddar marked this conversation as resolved.
Show resolved Hide resolved
config.setMinimumIdle(userConfig.getMinimumIdleConnections());
if (userConfig.getMinimumIdleConnections() != null) {
config.setMinimumIdle(userConfig.getMinimumIdleConnections());
}
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class PostgreSQLConfig {

@JsonProperty
@ConnectionPoolProperty
private int postgresql_minimum_idle_connections = 1;
private Integer postgresql_minimum_idle_connections = null;

@IgnoreForAnnotationCheck
boolean isValidAndNormalised = false;
Expand Down Expand Up @@ -246,7 +246,7 @@ public long getIdleConnectionTimeout() {
return postgresql_idle_connection_timeout;
}

public int getMinimumIdleConnections() {
public Integer getMinimumIdleConnections() {
return postgresql_minimum_idle_connections;
}

Expand Down Expand Up @@ -356,15 +356,17 @@ public void validateAndNormalise() throws InvalidConfigException {
"'postgresql_connection_pool_size' in the config.yaml file must be > 0");
}

if (postgresql_minimum_idle_connections <= 0) {
throw new InvalidConfigException(
"'postgresql_minimum_idle_connections' must be a positive value");
}
if (postgresql_minimum_idle_connections != null) {
if (postgresql_minimum_idle_connections < 0) {
throw new InvalidConfigException(
"'postgresql_minimum_idle_connections' must be >= 0");
}

if (postgresql_minimum_idle_connections > postgresql_connection_pool_size) {
throw new InvalidConfigException(
"'postgresql_minimum_idle_connections' must be less than or equal to "
+ "'postgresql_connection_pool_size'");
if (postgresql_minimum_idle_connections > postgresql_connection_pool_size) {
throw new InvalidConfigException(
"'postgresql_minimum_idle_connections' must be less than or equal to "
+ "'postgresql_connection_pool_size'");
}
}

// Normalisation
Expand Down
Loading