From 2f0ba8dc3f23ab3b57e1a1fd29a201d0833a55e9 Mon Sep 17 00:00:00 2001 From: runningbird2 <136336575+runningbird2@users.noreply.github.com> Date: Sat, 21 Feb 2026 12:34:33 +0000 Subject: [PATCH] fix: avoid main-thread world access in database path --- .../quiltservertools/ledger/database/DatabaseManager.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/kotlin/com/github/quiltservertools/ledger/database/DatabaseManager.kt b/src/main/kotlin/com/github/quiltservertools/ledger/database/DatabaseManager.kt index d99f66c7..2c8c6e19 100644 --- a/src/main/kotlin/com/github/quiltservertools/ledger/database/DatabaseManager.kt +++ b/src/main/kotlin/com/github/quiltservertools/ledger/database/DatabaseManager.kt @@ -19,7 +19,6 @@ import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.delay import kotlinx.coroutines.newSingleThreadContext import net.minecraft.core.BlockPos import net.minecraft.resources.Identifier @@ -424,10 +423,6 @@ object DatabaseManager { } private suspend fun execute(body: suspend Transaction.() -> T): T { - while (Ledger.server.overworld()?.noSave != false) { - delay(timeMillis = 1000) - } - return newSuspendedTransaction(context = databaseContext, db = database) { maxAttempts = MAX_QUERY_RETRIES minRetryDelay = MIN_RETRY_DELAY @@ -479,8 +474,7 @@ object DatabaseManager { this[Tables.Actions.objectId] = getOrCreateRegistryKeyId(action.objectIdentifier) this[Tables.Actions.oldObjectId] = getOrCreateRegistryKeyId(action.oldObjectIdentifier) this[Tables.Actions.world] = getOrCreateWorldId( - action.world ?: Ledger.server.overworld().dimension() - .identifier() + action.world ?: Identifier.fromNamespaceAndPath("minecraft", "overworld") ) this[Tables.Actions.blockState] = action.objectState this[Tables.Actions.oldBlockState] = action.oldObjectState