Skip to content

Commit

Permalink
fix(config): set initializationFailTimeout for hikari pool
Browse files Browse the repository at this point in the history
Don't immediately fail if DB initialization fails (e.g. cloud-sql-proxy isn't ready).
  • Loading branch information
tronghn committed Sep 20, 2023
1 parent 1e9380f commit 8ee2af6
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import io.nais.security.oauth2.config.HikariProperties.CONNECTION_TIMEOUT
import io.nais.security.oauth2.config.HikariProperties.IDLE_TIMEOUT
import io.nais.security.oauth2.config.HikariProperties.INITIALIZATION_FAIL_TIMEOUT
import io.nais.security.oauth2.config.HikariProperties.MAX_LIFETIME
import io.nais.security.oauth2.config.HikariProperties.MAX_POOL_SIZE
import io.nais.security.oauth2.config.HikariProperties.MIN_IDLE_CONNECTIONS
Expand Down Expand Up @@ -36,6 +37,7 @@ private fun hikariConfig(databaseConfig: DatabaseConfig) =
maxLifetime = MAX_LIFETIME
username = databaseConfig.user
password = databaseConfig.password
initializationFailTimeout = INITIALIZATION_FAIL_TIMEOUT
}

object HikariProperties {
Expand All @@ -44,4 +46,5 @@ object HikariProperties {
const val MAX_LIFETIME = 30001L
const val MAX_POOL_SIZE = 10
const val MIN_IDLE_CONNECTIONS = 5
const val INITIALIZATION_FAIL_TIMEOUT = 10000L
}

0 comments on commit 8ee2af6

Please sign in to comment.