mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
Prevent running webui auto update in parallel to the setup (#1759)
This commit is contained in:
@@ -84,6 +84,8 @@ object WebInterfaceManager {
|
|||||||
private val preferences = Injekt.get<Application>().getSharedPreferences("server_util", Context.MODE_PRIVATE)
|
private val preferences = Injekt.get<Application>().getSharedPreferences("server_util", Context.MODE_PRIVATE)
|
||||||
private var currentUpdateTaskId: String = ""
|
private var currentUpdateTaskId: String = ""
|
||||||
|
|
||||||
|
private var isSetupComplete = false
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
private val network: NetworkHelper by injectLazy()
|
private val network: NetworkHelper by injectLazy()
|
||||||
|
|
||||||
@@ -183,6 +185,7 @@ object WebInterfaceManager {
|
|||||||
@OptIn(DelicateCoroutinesApi::class)
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
setupWebUI()
|
setupWebUI()
|
||||||
|
isSetupComplete = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,25 +256,27 @@ object WebInterfaceManager {
|
|||||||
val lastAutomatedUpdate = preferences.getLong(LAST_WEBUI_UPDATE_CHECK_KEY, System.currentTimeMillis())
|
val lastAutomatedUpdate = preferences.getLong(LAST_WEBUI_UPDATE_CHECK_KEY, System.currentTimeMillis())
|
||||||
|
|
||||||
val task = {
|
val task = {
|
||||||
val log =
|
if (isSetupComplete) {
|
||||||
KotlinLogging.logger(
|
val log =
|
||||||
"${logger.name}::scheduleWebUIUpdateCheck(" +
|
KotlinLogging.logger(
|
||||||
"flavor= ${WebUIFlavor.current.uiName}, " +
|
"${logger.name}::scheduleWebUIUpdateCheck(" +
|
||||||
"channel= ${serverConfig.webUIChannel.value}, " +
|
"flavor= ${WebUIFlavor.current.uiName}, " +
|
||||||
"interval= ${serverConfig.webUIUpdateCheckInterval.value}h, " +
|
"channel= ${serverConfig.webUIChannel.value}, " +
|
||||||
"lastAutomatedUpdate= ${
|
"interval= ${serverConfig.webUIUpdateCheckInterval.value}h, " +
|
||||||
Date(
|
"lastAutomatedUpdate= ${
|
||||||
lastAutomatedUpdate,
|
Date(
|
||||||
)
|
lastAutomatedUpdate,
|
||||||
})",
|
)
|
||||||
)
|
})",
|
||||||
log.debug { "called" }
|
)
|
||||||
|
log.debug { "called" }
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
try {
|
try {
|
||||||
checkForUpdate(WebUIFlavor.current)
|
checkForUpdate(WebUIFlavor.current)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.error(e) { "failed due to" }
|
log.error(e) { "failed due to" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user