Skip to content

Commit

Permalink
Merge pull request #48 from ElroyKR/main
Browse files Browse the repository at this point in the history
feat: HikariCP MaximumPoolSize 항목 config에 추가
  • Loading branch information
cccgh5 authored Dec 6, 2023
2 parents cde2839 + 35e165c commit 30adc8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class DatabaseConfig(
val user = config.getString("database.mysql.user")
val password = config.getString("database.mysql.password")
val database = config.getString("database.mysql.database")
return MySQLDataSource(host, port, database, user, password)
val maximumPoolSize = config.getInt("database.mysql.maximum-pool-size", 10)
return MySQLDataSource(host, port, database, user, password, maximumPoolSize)
}

private fun buildSQLiteDataSource(): HikariDataSource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ class MySQLDataSource(
port: Int,
database: String,
user: String,
password: String
password: String,
maximumPoolSize: Int
) : HikariDataSource(HikariConfig().apply {
this.jdbcUrl = "jdbc:mysql://${host}:${port}/${database}?autoReconnect=true&allowMultiQueries=true"
this.driverClassName = "com.mysql.cj.jdbc.Driver"
this.username = user
this.password = password
this.connectionTestQuery = "SELECT 1"
this.poolName = "hqframework"
this.maximumPoolSize = maximumPoolSize
addDataSourceProperty("cachePrepStmts", "true")
addDataSourceProperty("prepStmtCacheSize", "250")
addDataSourceProperty("prepStmtCacheSqlLimit", "2048")
Expand Down
1 change: 1 addition & 0 deletions modules/bukkit-dist/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ database:
user: root
password: password
database: hq
maximum-pool-size: 10

scheduler:
thread-pool:
Expand Down

0 comments on commit 30adc8f

Please sign in to comment.