Skip to content

Commit

Permalink
[Hot Fix] - Postgres configuration related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjangid05 committed Jul 28, 2023
1 parent 15ff575 commit d1f5db0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit d1f5db0

Please sign in to comment.