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