From 6b0fddd421aa4b9c82b1dc5143254f283fa9eb0b Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 1 Nov 2025 19:31:13 +0100 Subject: [PATCH] Prevent running webui auto update in parallel to the setup (#1759) --- .../server/util/WebInterfaceManager.kt | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt index ba6ab153..0f462be8 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt @@ -84,6 +84,8 @@ object WebInterfaceManager { private val preferences = Injekt.get().getSharedPreferences("server_util", Context.MODE_PRIVATE) private var currentUpdateTaskId: String = "" + private var isSetupComplete = false + private val json: Json by injectLazy() private val network: NetworkHelper by injectLazy() @@ -183,6 +185,7 @@ object WebInterfaceManager { @OptIn(DelicateCoroutinesApi::class) GlobalScope.launch(Dispatchers.IO) { setupWebUI() + isSetupComplete = true } } @@ -253,25 +256,27 @@ object WebInterfaceManager { val lastAutomatedUpdate = preferences.getLong(LAST_WEBUI_UPDATE_CHECK_KEY, System.currentTimeMillis()) val task = { - val log = - KotlinLogging.logger( - "${logger.name}::scheduleWebUIUpdateCheck(" + - "flavor= ${WebUIFlavor.current.uiName}, " + - "channel= ${serverConfig.webUIChannel.value}, " + - "interval= ${serverConfig.webUIUpdateCheckInterval.value}h, " + - "lastAutomatedUpdate= ${ - Date( - lastAutomatedUpdate, - ) - })", - ) - log.debug { "called" } + if (isSetupComplete) { + val log = + KotlinLogging.logger( + "${logger.name}::scheduleWebUIUpdateCheck(" + + "flavor= ${WebUIFlavor.current.uiName}, " + + "channel= ${serverConfig.webUIChannel.value}, " + + "interval= ${serverConfig.webUIUpdateCheckInterval.value}h, " + + "lastAutomatedUpdate= ${ + Date( + lastAutomatedUpdate, + ) + })", + ) + log.debug { "called" } - runBlocking { - try { - checkForUpdate(WebUIFlavor.current) - } catch (e: Exception) { - log.error(e) { "failed due to" } + runBlocking { + try { + checkForUpdate(WebUIFlavor.current) + } catch (e: Exception) { + log.error(e) { "failed due to" } + } } } }