Make startSync non-suspend

This commit is contained in:
Bartu Özen
2025-12-18 20:23:02 +03:00
parent 3364d53c46
commit 5c0f714a3d
2 changed files with 6 additions and 14 deletions

View File

@@ -65,9 +65,7 @@ object SyncManager {
HAScheduler.schedule(
{
GlobalScope.launch {
startSync()
}
startSync()
},
interval = intervalMs,
delay = intervalMs,
@@ -81,7 +79,8 @@ object SyncManager {
)
}
suspend fun startSync() {
@OptIn(DelicateCoroutinesApi::class)
fun startSync() {
if (!serverConfig.syncYomiEnabled.value) {
return
}
@@ -90,9 +89,9 @@ object SyncManager {
return
}
try {
GlobalScope.launch {
syncData()
} finally {
}.invokeOnCompletion {
syncMutex.unlock()
}
}

View File

@@ -1,11 +1,7 @@
package suwayomi.tachidesk.graphql.mutations
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import suwayomi.tachidesk.global.impl.sync.SyncManager
import suwayomi.tachidesk.graphql.directives.RequireAuth
import suwayomi.tachidesk.server.serverConfig
class SyncMutation {
data class StartSyncInput(
@@ -16,14 +12,11 @@ class SyncMutation {
val clientMutationId: String? = null,
)
@OptIn(DelicateCoroutinesApi::class)
@RequireAuth
fun startSync(input: StartSyncInput): StartSyncPayload {
val (clientMutationId) = input
GlobalScope.launch {
SyncManager.startSync()
}
SyncManager.startSync()
return StartSyncPayload(
clientMutationId = clientMutationId,