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

[Hot Fix] - Postgres configuration related changes #86

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions src/main/java/com/uci/transformer/application/PostgresConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class PostgresConfig extends AbstractR2dbcConfiguration {
private String maxIdleTime;
@Value("${spring.r2dbc.maxSize}")
private String maxSize;
@Value("${spring.r2dbc.acquireRetry}")
private String acquireRetry;
@Value("${spring.r2dbc.maxCreateConnectionTime}")
private String maxCreateConnectionTime;
@Value("${spring.r2dbc.maxLifeTime}")
private String maxLifeTime;
@Value("${spring.r2dbc.maxAcquireTime}")
private String maxAcquireTime;

@Override
@Bean
Expand All @@ -64,6 +72,11 @@ public ConnectionFactory connectionFactory() {
ConnectionPoolConfiguration poolConfig = ConnectionPoolConfiguration.builder(connectionFactory)
.maxIdleTime(Duration.ofSeconds(Integer.parseInt(maxIdleTime))) // Customize the max idle time as per your needs
.maxSize(Integer.parseInt(maxSize))
.name("aggregate-pool")
.maxCreateConnectionTime(Duration.ofSeconds(Integer.parseInt(maxCreateConnectionTime)))
.acquireRetry(Integer.parseInt(acquireRetry))
.maxLifeTime(Duration.ofSeconds(Integer.parseInt(maxLifeTime)))
.maxAcquireTime(Duration.ofSeconds(Integer.parseInt(maxAcquireTime)))
.build();
return new ConnectionPool(poolConfig);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ spring.r2dbc.username=${FORMS_DB_USERNAME}
spring.r2dbc.password=${FORMS_DB_PASSWORD}
spring.r2dbc.maxIdleTime=${FORMS_DB_POOL_MAX_IDLE_TIME:#{30}}
spring.r2dbc.maxSize=${FORMS_DB_POOL_MAX_SIZE:#{100}}
spring.r2dbc.acquireRetry=${FORMS_DB_ACQUIRE_RETRY:#{3}}
spring.r2dbc.maxCreateConnectionTime=${FORMS_DB_MAX_CREATE_CONNECTION_TIME:#{30}}
spring.r2dbc.maxLifeTime=${FORMS_DB_MAX_LIFE_TIME:#{30}}
spring.r2dbc.maxAcquireTime=${FORMS_DB_MAX_ACQUIRE_TIME:#{30}}

#liquibase configuration
spring.liquibase.change-log=classpath:db/changelog-master.xml
Expand Down
Loading