Fix reload settings to affect cache too
This commit is contained in:
parent
ef481f12ca
commit
33fea67a44
|
@ -383,6 +383,8 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
|||
return
|
||||
}
|
||||
|
||||
cache.maxSize = newSettings.maxCacheSizeInMebibytes
|
||||
|
||||
// Setting loaded without issue. Figure out
|
||||
// if there are changes that require a restart
|
||||
val restartServer = newSettings.clientSecret != state.clientSettings.clientSecret ||
|
||||
|
@ -415,14 +417,6 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
|||
|
||||
LOGGER.info { "Starting Server after reloading ClientSettings" }
|
||||
loginAndStartServer()
|
||||
|
||||
// Start the WebUI if we had to stop it
|
||||
// and still want it
|
||||
if (startWebUi) {
|
||||
LOGGER.info { "Starting WebUI after reloading ClientSettings" }
|
||||
startWebUi()
|
||||
LOGGER.info { "Started WebUI after reloading ClientSettings" }
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// If we aren't restarting the server
|
||||
|
@ -430,14 +424,14 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
|||
this.state = state.copy(clientSettings = newSettings)
|
||||
serverHandler.settings = newSettings
|
||||
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
|
||||
}
|
||||
|
||||
// Start the WebUI if we had to stop it
|
||||
// and still want it
|
||||
if (startWebUi) {
|
||||
LOGGER.info { "Starting WebUI after reloading ClientSettings" }
|
||||
startWebUi()
|
||||
LOGGER.info { "Started WebUI after reloading ClientSettings" }
|
||||
}
|
||||
// Start the WebUI if we had to stop it
|
||||
// and still want it
|
||||
if (startWebUi) {
|
||||
LOGGER.info { "Starting WebUI after reloading ClientSettings" }
|
||||
startWebUi()
|
||||
LOGGER.info { "Started WebUI after reloading ClientSettings" }
|
||||
}
|
||||
} catch (e: UnrecognizedPropertyException) {
|
||||
LOGGER.warn { "Settings file is invalid: '$e.propertyName' is not a valid setting" }
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy
|
|||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
import dev.afanasev.sekret.Secret
|
||||
|
||||
// client settings are verified correct in Main.kt
|
||||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class)
|
||||
data class ClientSettings(
|
||||
val maxCacheSizeInMebibytes: Long = 20480,
|
||||
|
|
Loading…
Reference in a new issue