mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-25 04:54:07 +01:00
Fix/using postgresql with hikaricp (#1867)
* Set default schema for postgresql db
The schema was only set once during startup. This is, however, only set for the current connection. So when using hikaricp, depending on which connection was used, the schema might have been set, or it might not have been set.
fixes #1670
* Revert "Fix database connection and errors (#1681)"
This reverts commit 2e0f72f182.
Not necessary anymore as the issue that this change intended to fix is now fixed with 091206800025ed9370d611e7ca3430ab409a0cb2
This commit is contained in:
@@ -65,11 +65,11 @@ object DBManager {
|
||||
|
||||
// Optimized for Raspberry Pi / Low memory environments
|
||||
maximumPoolSize = 6 // Moderate pool for better concurrency
|
||||
minimumIdle = 2 // Keep 2 idle connections for responsiveness
|
||||
connectionTimeout = 45.seconds.inWholeMilliseconds // more tolerance for slow devices
|
||||
idleTimeout = 5.minutes.inWholeMilliseconds // close idle connections faster
|
||||
maxLifetime = 15.minutes.inWholeMilliseconds // recycle connections more often
|
||||
leakDetectionThreshold = 1.minutes.inWholeMilliseconds
|
||||
isAutoCommit = false
|
||||
|
||||
// Pool name for monitoring
|
||||
poolName = "Suwayomi-DB-Pool"
|
||||
@@ -94,6 +94,11 @@ object DBManager {
|
||||
useNestedTransactions = true
|
||||
@OptIn(ExperimentalKeywordApi::class)
|
||||
preserveKeywordCasing = false
|
||||
defaultSchema =
|
||||
when (serverConfig.databaseType.value) {
|
||||
DatabaseType.POSTGRESQL -> Schema("suwayomi")
|
||||
DatabaseType.H2 -> null
|
||||
}
|
||||
}
|
||||
|
||||
return if (serverConfig.useHikariConnectionPool.value) {
|
||||
@@ -175,7 +180,6 @@ fun databaseUp() {
|
||||
serverConfig.databaseUsername.value.takeIf { it.isNotBlank() },
|
||||
)
|
||||
SchemaUtils.createSchema(schema)
|
||||
SchemaUtils.setSchema(schema)
|
||||
}
|
||||
}
|
||||
val migrations = loadMigrationsFrom("suwayomi.tachidesk.server.database.migration", ServerConfig::class.java)
|
||||
|
||||
Reference in New Issue
Block a user