mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
perf: database connection pooling
This commit is contained in:
parent
3256f3f300
commit
58fde3e7aa
2 changed files with 8 additions and 1 deletions
|
|
@ -70,6 +70,9 @@ class KomgaProperties {
|
||||||
|
|
||||||
@get:Positive
|
@get:Positive
|
||||||
var batchChunkSize: Int = 1000
|
var batchChunkSize: Int = 1000
|
||||||
|
|
||||||
|
@get:Positive
|
||||||
|
var maxPoolSize: Int = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
class Lucene {
|
class Lucene {
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,15 @@ class DataSourcesConfiguration(
|
||||||
.type(SqliteUdfDataSource::class.java)
|
.type(SqliteUdfDataSource::class.java)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
val poolSize =
|
||||||
|
if (komgaProperties.database.file.contains(":memory:")) 1
|
||||||
|
else Runtime.getRuntime().availableProcessors().coerceAtMost(komgaProperties.database.maxPoolSize)
|
||||||
|
|
||||||
return HikariDataSource(
|
return HikariDataSource(
|
||||||
HikariConfig().apply {
|
HikariConfig().apply {
|
||||||
dataSource = sqliteUdfDataSource
|
dataSource = sqliteUdfDataSource
|
||||||
poolName = "SqliteUdfPool"
|
poolName = "SqliteUdfPool"
|
||||||
maximumPoolSize = 1
|
maximumPoolSize = poolSize
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue