mirror of
https://github.com/gotson/komga.git
synced 2025-12-16 13:33:49 +01: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
|
||||
var batchChunkSize: Int = 1000
|
||||
|
||||
@get:Positive
|
||||
var maxPoolSize: Int = 8
|
||||
}
|
||||
|
||||
class Lucene {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,15 @@ class DataSourcesConfiguration(
|
|||
.type(SqliteUdfDataSource::class.java)
|
||||
.build()
|
||||
|
||||
val poolSize =
|
||||
if (komgaProperties.database.file.contains(":memory:")) 1
|
||||
else Runtime.getRuntime().availableProcessors().coerceAtMost(komgaProperties.database.maxPoolSize)
|
||||
|
||||
return HikariDataSource(
|
||||
HikariConfig().apply {
|
||||
dataSource = sqliteUdfDataSource
|
||||
poolName = "SqliteUdfPool"
|
||||
maximumPoolSize = 1
|
||||
maximumPoolSize = poolSize
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue