mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-14 08:14:34 -05:00
Fix/server startup blocked by synchronous tasks (#1018)
* Launch missed auto backup task in background * Launch missed auto global update task in background * Launch missed auto webui update check task in background
This commit is contained in:
@@ -5,8 +5,10 @@ import android.content.Context
|
||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancelChildren
|
||||
import kotlinx.coroutines.channels.BufferOverflow
|
||||
@@ -124,6 +126,7 @@ class Updater : IUpdater {
|
||||
addCategoriesToUpdateQueue(Category.getCategoryList(), clear = true, forceAll = false)
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun scheduleUpdateTask() {
|
||||
HAScheduler.deschedule(currentUpdateTaskId)
|
||||
|
||||
@@ -141,7 +144,9 @@ class Updater : IUpdater {
|
||||
if (lastAutomatedUpdate > 0) lastAutomatedUpdate else System.currentTimeMillis()
|
||||
) < updateInterval
|
||||
if (!wasPreviousUpdateTriggered) {
|
||||
autoUpdateTask()
|
||||
GlobalScope.launch {
|
||||
autoUpdateTask()
|
||||
}
|
||||
}
|
||||
|
||||
HAScheduler.schedule(::autoUpdateTask, updateInterval, timeToNextExecution, "global-update")
|
||||
|
||||
Reference in New Issue
Block a user