Skip to content

Commit

Permalink
fix: bruker default på maxLifetime i connection pool
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsladek committed Dec 5, 2024
1 parent e868679 commit c0aadb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.naming.NamingException;
Expand Down Expand Up @@ -78,9 +79,8 @@ private static HikariDataSource createDatasource(String jdbcUrl, String username
cfg.setJdbcUrl(jdbcUrl);
cfg.setUsername(username);
cfg.setPassword(password);
cfg.setConnectionTimeout(1500);
cfg.setValidationTimeout(120L * 1000L);
cfg.setMaximumPoolSize(4);
cfg.setConnectionTimeout(TimeUnit.SECONDS.toMillis(2)); // feiler fast hvis db ikke kjører lokalt.
cfg.setAutoCommit(false);

var ds = new HikariDataSource(cfg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.foreldrepenger.abakus.jetty;

import java.util.Properties;
import java.util.concurrent.TimeUnit;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
Expand Down Expand Up @@ -34,10 +35,9 @@ private static HikariConfig initConnectionPoolConfig(int maxPoolSize) {
var config = new HikariConfig();

config.setJdbcUrl(ENV.getRequiredProperty("defaultDS.url"));
config.setConnectionTimeout(TimeUnit.SECONDS.toMillis(1));
config.setMinimumIdle(0);
config.setMaximumPoolSize(maxPoolSize);
config.setIdleTimeout(10001);
config.setMaxLifetime(30001);
config.setConnectionTestQuery("select 1");
config.setDriverClassName("org.postgresql.Driver");
config.setMetricRegistry(Metrics.globalRegistry);
Expand Down

0 comments on commit c0aadb1

Please sign in to comment.