diff --git a/migreringer/src/test/java/no/nav/foreldrepenger/abakus/dbstoette/TestDatabaseInit.java b/migreringer/src/test/java/no/nav/foreldrepenger/abakus/dbstoette/TestDatabaseInit.java index f28354114..f1f3fc99f 100644 --- a/migreringer/src/test/java/no/nav/foreldrepenger/abakus/dbstoette/TestDatabaseInit.java +++ b/migreringer/src/test/java/no/nav/foreldrepenger/abakus/dbstoette/TestDatabaseInit.java @@ -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; @@ -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); diff --git a/web/src/main/java/no/nav/foreldrepenger/abakus/jetty/DatasourceUtil.java b/web/src/main/java/no/nav/foreldrepenger/abakus/jetty/DatasourceUtil.java index 7803863c6..f81bb3d86 100644 --- a/web/src/main/java/no/nav/foreldrepenger/abakus/jetty/DatasourceUtil.java +++ b/web/src/main/java/no/nav/foreldrepenger/abakus/jetty/DatasourceUtil.java @@ -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; @@ -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);